fix(tui): tmux text selection with auto-scroll and OSC 52 copy - #5
Open
FeiSong123 wants to merge 7 commits into
Open
fix(tui): tmux text selection with auto-scroll and OSC 52 copy#5FeiSong123 wants to merge 7 commits into
FeiSong123 wants to merge 7 commits into
Conversation
…rdinates Dragging past the top or bottom edge now scrolls the viewport and extends the selection, so a drag can copy more than one screen of history. Selection points moved from screen-window coordinates to full-content coordinates so scrolling mid-drag keeps the anchor on the same text instead of drifting with the viewport.
…atch The write tool itself has no size cap, but the tool-call channel does: roughly 8KB of raw text, with CJK characters counting about six times their byte size once JSON-escaped. Say so in the write tool description so the model reaches for a bash heredoc instead of retrying a doomed write. This moves the frozen tool schema, so the pinned Cache ABI and request golden hashes move with it.
Dragging at the top or bottom edge forced a synchronous full repaint on every motion report, which stuttered and flickered. Scroll now moves one line per 50ms interval and leaves the repaint to the batched render timer; when there is no more content in that direction the selection head pins to the edge so the highlight follows the cursor instead of jumping.
Auto-scroll now runs on a setTimeout chain once the drag rests on an edge, so it keeps stepping even when the mouse stops moving. It also only scrolls while the drag is already moving that way (head above the anchor at the top edge, below it at the bottom), which stops the occasional reverse flicker at the edge.
In the non-scroll viewport the render pipeline keeps the full content, but the highlight was indexed as if it were already the visible window, so the reverse-video landed on a line that had scrolled off screen while the selection under the mouse stayed unhighlighted. Track the content line of newLines[0] separately for highlighting and mouse mapping.
The auto-scroll direction check used <= and >=, so a click on the top or bottom row already qualified as a drag and the viewport started scrolling against the user's first movement. Match prime-agent's strict comparison: only scroll up once the head is strictly above the anchor, and only scroll down once it is strictly below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Mouse selection in tmux, plus one tool-contract fix.
1. Click-drag text selection with OSC 52 copy
Left-button drag selects text in the rendered window with reverse-video highlight, and release copies the plain text to the system clipboard via OSC 52. Selection points live in full-content coordinates, so scrolling mid-drag keeps the anchor on the same text.
2. Auto-scroll across screens
Dragging past the top or bottom edge scrolls the viewport and extends the selection. Auto-scroll runs on a timer once the drag rests on an edge, so it keeps stepping even when the mouse stops moving. It only engages after a real drag (head strictly above the anchor at the top edge, strictly below at the bottom), so a click on an edge row does not start scrolling against the first movement.
3. Highlight under the cursor
The highlight was indexed as if the render buffer were always the visible window, so in the non-scroll viewport the reverse-video landed on a line that had scrolled off screen. The renderer now tracks the content line of the buffer's first row separately for highlighting and mouse mapping.
4. Document the write size limit
The write tool has no size cap itself, but the tool-call channel does (roughly 8KB raw, CJK counting ~6x once JSON-escaped). The write description now says so and points at the bash heredoc escape hatch. This moves the frozen tool schema, so the pinned Cache ABI and request golden hashes move with it.
Tests
npm run checkpasses