Menu

#1892 Inconsistent line moving with empty lines

Bug
closed-invalid
scintilla (591)
5
2017-02-20
2016-12-11
vlakoff
No

Assume I have the following content:

foo
foo

bar
bar

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

Discussion

  • Neil Hodgson

    Neil Hodgson - 2016-12-12

    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.

     
  • vlakoff

    vlakoff - 2016-12-12

    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").

     
    • Neil Hodgson

      Neil Hodgson - 2016-12-12

      I don't understand what you mean by '"single line" mode'.

       
  • vlakoff

    vlakoff - 2016-12-12

    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
    • Neil Hodgson

      Neil Hodgson - 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.

       
  • vlakoff

    vlakoff - 2016-12-15

    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".

     
    • Neil Hodgson

      Neil Hodgson - 2016-12-15

      "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.

       
  • Neil Hodgson

    Neil Hodgson - 2016-12-15
    • labels: --> scintilla
    • status: open --> open-invalid
    • assigned_to: Neil Hodgson
     
  • Neil Hodgson

    Neil Hodgson - 2017-02-20
    • status: open-invalid --> closed-invalid
     

Log in to post a comment.