fix(tui): preserve multi-click text selection - #45292
Open
kitlangton wants to merge 1 commit into
Open
Conversation
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 free
to 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.
Why
The click-only selection guard introduced with #44971 clears selection on mouse release. OpenTUI also resets its multi-click counter when selection is cleared, so double- and triple-clicks never reach word or line selection when copy-on-select is enabled.
This caused the deterministic selection-test failures seen in #45157. That branch passed locally because it lacked the upstream guard, while CI tested the combined merge commit.
What Changes
Selection History
Stationary word and line selections can still report
isStart = true. Only a start-only cell selection is treated as a bare click. Mouse-release copying ignores invalid selections instead of clearing them, preserving the renderer-owned click count without private-state manipulation.Demo
Matched real OpenCode Drive recordings: base
cbef698861on the left and fixaa6297f7aeon the right. Both use the same fictional simulated response and native SGR mouse input through the real TUI. Before: double/triple clicks select nothing. After: word and line highlights remain visible and clipboard confirmation appears.click-selection-before-after.mp4
Scope
Restores real double/triple-click behavior without weakening the existing dialog or selection tests. A bare embedded-terminal click retains its native single-cell highlight until another interaction clears or replaces it, but never auto-copies that cell. Explicit copy retains its existing invalid-selection cleanup.
Verification
Focused tests: 560 passed across 20 repeats. Full TUI suite: 810 passed, 5 skipped, 0 failed. Typecheck, lint, formatting, and all 32 pre-push workspace typecheck tasks passed. Includes real embedded-terminal coverage for click suppression, nonempty drag copying/highlight preservation, and empty drags. Local validation was on macOS; Linux and Windows validation runs in CI.