Assume I have the following content:
I can move one or both "foo" lines by selecting anything across these lines, then pressing "ctrl+shift+up/down".
But if I want to also move the empty line, it doesn't work as well.
- If the selection end is at the empty line, the empty line is not moved.
- If the selection end is at the beginning of the "bar" line, the empty line is moved, and the "bar" line is not moved.
- If the selection end is in the "bar" line except at the beginning, the "bar" line is moved, obviously.
I think the points 1 and 2 above are inconsistent, the behaviour should be:
- If the selection end is at the empty line, the empty line should be moved.
- If the selection end is at the beginning of the "bar" line, the "bar" line should be moved too.
See: Editor::MoveSelectedLines
in Editor.cxx
The basic function moves lines that have been completely selected, including their new line characters. When partial lines are selected, the range is first expanded to all of the lines that have been partially selected first.
If you want to move an empty line then select the whole line including its line end characters. This matches the line selection margin's behaviour of including the line end characters when selecting a line.
So likewise, if the selection end is at the beginning of a non-empty line, this line is not moved.
I think this is inconsistent with "single line" mode, and counterintuitive (if I consider "where the caret is" rather than "invisible newlines selected").
I don't understand what you mean by '"single line" mode'.
If selected nothing, or part of a single line, pressing "ctrl+shift+up/down" just moves the current line (i.e. "where the caret is").
Last edit: vlakoff 2016-12-12
Whole line selections in Scintilla, such as created by triple clicking or line margin clicks, include the line end characters. This ensures reasonable behaviour for performing actions such as copy and cut.
If you select a line by triple clicking it, then that is all you want to move with up/down. You don't want the next line to move just because the caret is on it, even if it is empty.
You made a point with the triple clicking. So, considering the current behavior is expected and arguably consistent, I suppose this can be closed as "wontfix".
"wontfix" is for issues that are recognised as bugs but are too difficult to fix. This isssue is marked as "invalid" as the current behaviour appears better to me than the alternative.