Skip to content

Conversation

@danolekh
Copy link

fixes #521 and makes possible to properly implement #518

overview from clod:

Problem: Shift+cmd+arrow keys (select to buffer home/end) didn't work correctly in scrollable Textareas because selection anchor coordinates were captured relative to the wrong viewport position.

Root Cause: updateSelectionForMovement stored selection anchor using viewport-relative visual coordinates. When the viewport scrolled during a large cursor jump, the anchor became invalid.

Solution:

  1. Store selection anchor using logical coordinates (row, col) which are document-absolute
  2. Added scrollToCursor() to explicitly scroll viewport to cursor (bypassing the normal scroll-skip during selection)
  3. After movement, convert anchor logical coords to visual coords based on current viewport

fix tested in alacritty & kitty terminals

preview
https://github.com/user-attachments/assets/7a61e7f2-6a87-4cbf-843f-b760d9619f76

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.

bug: weird select behaviour when textarea is scrollable

1 participant