Skip to content

Conversation

@stefanhaller
Copy link
Collaborator

Reviewed as part of jesseduffield/lazygit#3836.

Similar to the code in GoToEndOfLine, we need to move left by one character when
setting the cursor position to a soft line break, so that we end up at the last
whitespace before the line break.

This fixes pressing up-arrow or down-arrow at the end of a line when jumping to
an auto-wrapped line that is shorter.
The logic didn't take scrolling into account; also, not only do we need to
constrain the x position to the line length, but also the y position to the
number of lines.
We insert \0 cells at the end of lines, presumably to properly support turning
off styles at line ends. When clicking into an editable view after the end of a
line, we need to skip past these.
v.SetCursor doesn't do this, we need to call SetCursor2D on the TextArea in
addition.
@stefanhaller stefanhaller merged commit a3adeb7 into master Aug 24, 2024
@stefanhaller stefanhaller deleted the improve-mouse-handling-in-editable-views branch August 24, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants