fix(webui): allow native text selection in chat via xterm.js bypass (#25720)#25777
Closed
wesleysimplicio wants to merge 1 commit into
Closed
fix(webui): allow native text selection in chat via xterm.js bypass (#25720)#25777wesleysimplicio wants to merge 1 commit into
wesleysimplicio wants to merge 1 commit into
Conversation
…ousResearch#25720) The chat panel renders via xterm.js, and when the inner Hermes TUI enables mouse-events mode (CSI ?1000h family — used for nav inside Ink overlays/pickers) every drag/double-click/triple-click in the canvas is consumed by the terminal instead of producing a native text selection. The reporter (macOS, Brave) confirmed: - click-and-drag selects nothing - Cmd+C with no selection copies the entire visible buffer - existing CSS overrides and event handlers at the document layer have no effect — the issue is at xterm.js's mouse layer, not the DOM Fix: two xterm.js options the user can opt into without disabling mouse-events mode for the inner TUI: - `macOptionClickForcesSelection: true` — holding Option (macOS) or Alt (Linux/Windows) during a click-and-drag bypasses mouse-events mode and produces a native xterm selection. This is the documented xterm.js path for this exact scenario. Selected text is copyable via Cmd+C / Ctrl+C through the existing OSC 52 + manual handlers. - `rightClickSelectsWord: true` — right-click highlights the word under the pointer. Single-action path on top of the modifier-based bypass. The two options coexist with the existing `macOptionIsMeta: true` (which only affects keyboard, not mouse). No other code change needed. Fixes NousResearch#25720.
|
Reporter here, confirmed this fix would resolve my workflow. Thanks @wesleysimplicio ! |
teknium1
added a commit
that referenced
this pull request
May 17, 2026
…tors Adds release-note attribution mappings for the contributors from group 5: - @haran2001 (PR #27070, #27068) - @ms-alan (PR #26443) - @godlin-gh (PR #26118) - @wesleysimplicio (PR #25777, ext-email form) - @Carry00 (PR #26851) - @alaamohanad169-ship-it (PR #26036) - @hawknewton (PR #26294) (YanzhongSu PR #25879 and flamiinngo PR #27231 already mapped.)
Contributor
|
Merged via PR #27382 — your commit was cherry-picked onto current |
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
…tors Adds release-note attribution mappings for the contributors from group 5: - @haran2001 (PR NousResearch#27070, NousResearch#27068) - @ms-alan (PR NousResearch#26443) - @godlin-gh (PR NousResearch#26118) - @wesleysimplicio (PR NousResearch#25777, ext-email form) - @Carry00 (PR NousResearch#26851) - @alaamohanad169-ship-it (PR NousResearch#26036) - @hawknewton (PR NousResearch#26294) (YanzhongSu PR NousResearch#25879 and flamiinngo PR NousResearch#27231 already mapped.)
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.
Summary
Fixes #25720. The chat panel renders via xterm.js, and when the inner Hermes TUI enables mouse-events mode (CSI ?1000h family — used for nav inside Ink overlays/pickers) every drag, double-click, triple-click, and Option+drag in the canvas is consumed by the terminal instead of producing a native text selection.
Reporter (macOS, Brave) confirmed click-and-drag selects nothing, Cmd+C with no selection copies the entire visible buffer, and existing CSS overrides at the document layer have no effect — the issue is at xterm.js's mouse layer, not the DOM.
Fix
Two xterm.js options the user can opt into without disabling mouse-events mode for the inner TUI:
macOptionClickForcesSelection: true— holding Option (macOS) or Alt (Linux/Windows) during a click-and-drag bypasses mouse-events mode and produces a native xterm selection. This is the documented xterm.js path for exactly this scenario. Selected text is then copyable via Cmd+C / Ctrl+C through the existing OSC 52 + manual handlers already present inChatPage.tsx.rightClickSelectsWord: true— right-click highlights the word under the pointer. Single-action path on top of the modifier-based bypass.Matches the issue's suggested fix #2 ("Ensure xterm.js Option-click selection bypass works as documented").
Why these two
The two options coexist with the existing
macOptionIsMeta: true(which only affects keyboard, not mouse). The alternative — disabling mouse-events mode entirely — would break inner-TUI behaviour (overlays, pickers, scroll-via-mouse in Ink components), and the reporter explicitly noted suggestion #1 as one option among several. The modifier-key bypass is the lowest-impact fix that solves the reporter's actual workflow ("copy code snippets / commands / URLs out of agent output").Solution sketch
flowchart TD A[User drags inside chat canvas] --> B{Mouse-events mode active?} B -- no --> C[Native selection works as today] B -- yes --> D{Option/Alt held?} D -- no --> E[Inner TUI consumes the drag] D -- yes --> F[xterm forces native selection] F --> G[Cmd+C copies selection via OSC 52]Tests
web/package.jsondoes not ship a test runner — onlydev,build,lint,preview. The change is two configuration flags inside the existingnew Terminal({...})call. Verified:macOptionIsMeta,macOptionClickForcesSelection,rightClickSelectsWord) are documented xterm.js v6 options (the version inweb/package.json: "@xterm/xterm": "^6.0.0").ChatPage.tsxalready pick up arbitrary xterm selections, so adding the bypass automatically routes selected text through the system clipboard.Manual verification path for reviewers:
/chat, hold Option, drag across some agent output → highlight appears, Cmd+C copies.Duplicate check
gh pr list --state open --search "25720 in:body,title"→ 0gh pr list --state open --search "xterm macOptionClickForcesSelection rightClickSelectsWord"→ 0Funnel discipline
Opened under doc 23. Issue has 0 open competing PRs and no merged fix in the same area at time of opening.