Introduce LineEnding to editor and fix inconsistencies#2759
Conversation
|
These changes still leave us with conditions where the control/content-store is changing the content in unexpected/unintuitive ways. If I initialise the content with Given that trailing newlines in files have importance in various circumstances, I would not expect the control to be making changes to the provided content. For the above example, I would expect the initialised control to have content which is two lines long, but it does not do so. If it is initialised with content which has a mix of CR/CRLF/LF, the character inserted on pressing return/enter is dependent on the line-ending it has determined for the line you were on at the time you pressed return/enter, which results in the same action (pressing return) having multiple different possible outcomes. It can also make changes in places unrelated to where the cursor is currently placed. If I start with content of "Line 1\nLine 2\r\nLine 3", There also doesn't seem to be a way of specifying which new-line character to use with the editor, so an editor with empty content from ``text_editor::Content::new()
I would question why this has been implemented with the content stored as a collection of lines. For display purposes it could be considered as a range of lines, but in terms of the actual underlying content, especially if loaded from a file, it's just a collection of bytes some of which have specific/special meaning when being displayed. |
|
@CyberCeisc These are all We will have to wait until line endings are properly handled there, or roll our own editing logic. |
In which case can we re-open the issue I raised to show that it has not been fixed as it feels likely I won't be the only one who the current behaviours create problems for? |
|
Open a new one. The original issue is fixed.
|
Fixes #2730.