Skip to content

fix: mouse text selection broken by missing bottom-alignment padding - #175

Merged
gi-dellav merged 1 commit into
gi-dellav:mainfrom
wowi42:fix/mouse-selection-padding
Jul 8, 2026
Merged

gi-dellav merged 1 commit into
gi-dellav:mainfrom
wowi42:fix/mouse-selection-padding

Conversation

@wowi42

@wowi42 wowi42 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem

Click-and-drag text selection in the chat viewport was broken — clicks on the content area returned `None` from `buffer_line_at_row()`, so no selection was ever started.

Root Cause

`buffer_line_at_row()` started `visual_row` at 0, but the viewport renders padding rows at the top before actual content when auto-scrolled and content is shorter than the viewport (bottom-alignment). This meant clicks in the content area were off by `pad` rows.

Fix

Start `visual_row` at `pad` (instead of 0) to match the rendering offset. Also hoisted the `pad` computation so it's available for both the early-return guard and the `visual_row` initial value.

buffer_line_at_row() started visual_row at 0, but the viewport
renders padding rows before content when auto-scrolled and content is
shorter than the viewport. This caused clicks in the content area to
be off by `pad` rows, so most clicks returned None and no selection
was ever started.

Now visual_row starts at `pad` to match the rendering offset.
@gi-dellav

Copy link
Copy Markdown
Owner

Thank you, merged!

@gi-dellav
gi-dellav merged commit f77cf7c into gi-dellav:main Jul 8, 2026
1 check passed
@wowi42
wowi42 deleted the fix/mouse-selection-padding branch July 9, 2026 01:54
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