Skip to content

Inconsistent behavior of cursor keys depending on whether selection mode is active (newlines) after upgrading to 2.0.14 #3476

@inga-lovinde

Description

@inga-lovinde

Description of the problem or steps to reproduce

Create a new file with the following content:

123
456789
abc
def

Position cursor to 1, press arrow down, observe that the cursor is currently at 4, as expected.
Position cursor to 4, press arrow down, observe that the cursor is currently at a, as expected.

Now position cursor to 1, press Shift + arrow down, observe that the entire line 123 is selected (including the trailing newline), as expected. Press arrow down again to clear the selection and move to the next line, observe that the cursor is currently at 7, which is not expected and not how other similar text editors typically work (expected would be the cursor at 4 or a).
Position cursor to 4, repeat the same steps, observe that the cursor is now on abc line after c (expected would be the cursor at a or d).

Basically the problem is that after selection with Shift+down, the cursor seems to move to the newline character of the selected line, rather than the place immediately below the originally focused character (or the rightmost place of the line below if it's too short and doesn't reach the originally focused character).

This breaks patterns like: "Ctrl+Home, Shift+down, Ctrl+C, down, down, Ctrl+V" which used to insert a copy of the first line as the new line between two other lines, but now instead appends a copy of the first line (including the newline character) to the other line.

In 2.0.13 this used to work as expected, producing for the document

meow
meow
meow
meow
meow

the new content

meow
meow
meow
meow
meow
meow

But the behavior changed in 2.0.14, and the same commands now produce

meow
meow
meowmeow

meow
meow

Specifications

Commit hash: 04c5770
OS: Alpine Linux Edge (rolling release) x86_64
Terminal: foot 1.18.1, also reproducible on wezterm 20240203.110809.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions