Skip to content

fix: selection follows scroll and auto-scrolls at viewport edges#20

Merged
190km merged 2 commits intomainfrom
fix/scroll-while-select
Mar 29, 2026
Merged

fix: selection follows scroll and auto-scrolls at viewport edges#20
190km merged 2 commits intomainfrom
fix/scroll-while-select

Conversation

@190km
Copy link
Copy Markdown
Owner

@190km 190km commented Mar 29, 2026

Summary

  • Scroll sync during active selection: When scrolling via mouse wheel while dragging a text selection, the selection coordinates now stay in sync with the changing display offset. Previously the selection would drift and highlight wrong content.
  • Auto-scroll at viewport edges: When dragging a selection above or below the terminal body, the terminal now auto-scrolls in that direction and extends the selection into the newly visible content. Scroll speed scales with pointer distance from the edge.
  • Helper method: Added auto_scroll_selection() to atomically scroll the terminal and update selection coordinates, preventing any mismatch between scroll state and selection state.

Test plan

  • Start a selection drag in a terminal with scrollback history
  • While still dragging, scroll with the mouse wheel — verify the selection highlight stays on the correct text
  • Drag the selection above the terminal top edge — verify the terminal scrolls up into history and the selection extends
  • Drag the selection below the terminal bottom edge — verify the terminal scrolls down toward recent output and the selection extends
  • Release the mouse and copy — verify the copied text matches the highlighted selection

190km added 2 commits March 29, 2026 21:57
When scrolling via mouse wheel during an active selection drag, the
selection coordinates now stay in sync with the changing display offset.
When dragging above or below the terminal viewport, the terminal
auto-scrolls and extends the selection into newly visible content.
…tions

Selection rows were usize, clamped to 0 when scrolling down past the
start. Changed to i32 so the start can go negative (above viewport).
The renderer already handles offset_delta correctly — removed the
redundant scroll sync that was fighting with it.
@190km 190km merged commit 8ebc9ce into main Mar 29, 2026
8 checks passed
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.

1 participant