Skip to content

desktop: keep the shift+drag selection after release (0.3.1) - #9

Merged
ralyodio merged 2 commits into
mainfrom
fix/shift-drag-selection
Oct 9, 2026
Merged

ralyodio merged 2 commits into
mainfrom
fix/shift-drag-selection

Conversation

@ralyodio

@ralyodio ralyodio commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Bug: in hqterm desktop, shift+drag highlighted text, but the highlight disappeared as soon as the mouse button was released.

Cause: hqtui turns on any-motion mouse tracking (DECSET 1003) for hover. xterm.js treats every mouse report as user input (triggerDataEvent(report, true) → onUserInput), and SelectionService clears the selection on user input. Shift+drag stops reports while the button is held. After release, though, the first hover motion sends a report, and that report clears the selection.

Fix:

  • While text is selected and the tracking mode is any, a capture-phase listener on the pane stops button-less mousemove events, so xterm sends no hover report. Clicks, wheel and keys still clear the selection as before. Hover comes back once the selection is cleared.
  • On Linux, the selection is also written to PRIMARY, so middle-click pastes it. Ctrl+Shift+C still copies to the clipboard.
  • New CI smoke step: it enables 1003 in the focused pane, does a synthetic shift+drag, moves the mouse after release, and exits 5 if the selection is gone.

Could not run Electron locally (no display or Xvfb on the box). The Xvfb smoke test in CI covers it.

🤖 Generated with Claude Code

ralyodio and others added 2 commits October 9, 2026 03:39
hqtui enables any-motion mouse tracking (DECSET 1003) for hover. xterm.js
treats every mouse report as user input and clears the selection on it, so
the first hover report after releasing a shift+drag wiped the highlight.
Hold back button-less motion reports while text is selected.

Also put the selection on the Linux PRIMARY selection (middle-click paste),
and add a smoke-test step that shift+drags under 1003 and fails if the
selection does not survive the mouse moving on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…de_modules too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit e5cd248 into main Oct 9, 2026
5 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