feat(console): cluster 1 polish — search, paste guard, shortcut, tab rename - #143
Merged
Conversation
…rename Refs #142 (cluster 1). - xterm-addon-search vendored (@xterm/addon-search 0.15.0). - Search bar markup + CSS: input, prev/next, count, close, Esc to close. Ctrl-F / Cmd-F inside the terminal is intercepted via attachCustomKeyEventHandler so it opens the find bar instead of going to the shell. Each session lazy-loads its own search addon on first use. Result count is rendered live via the addon's onDidChangeResults callback ("3 / 12"). - Large-paste confirm modal: pastes with >= 20 newlines pop a modal with a preview (capped at first 30 lines / 1200 chars). Confirm pipes the text into the active session's PTY via the new ConsoleSession.sendText path; Cancel discards. Document-level paste listener checks that an xterm host is focused before intercepting. Bracketed paste itself rides on the remote shell turning DECSET 2004 on — xterm wraps with ESC[200~/ESC[201~ automatically when asked, so no client-side toggle needed. - Ctrl-Shift-` global shortcut opens a console for the current box (reads the box_id cookie set by switchBox). No-op when no box is pinned — palette is the fallback. - Double-click on a tab label swaps the label into an inline text input; blur/Enter commits, Escape reverts. The rename is per-session (lives on session.label); session.baseLabel still carries the canonical box name for tooltips and #N disambiguation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds quality-of-life improvements to Gearbox’s multi-session remote console, aligning with issue #142 “Cluster 1” (search-in-buffer, large-paste guard, global open-console shortcut, and tab rename).
Changes:
- Add “find in terminal buffer” UX (Ctrl/Cmd-F) backed by a newly vendored
@xterm/addon-search. - Add a large multi-line paste confirmation modal with preview + confirm/cancel flow.
- Add global open-console shortcut (Ctrl-Shift-`) and per-tab inline rename (dblclick).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| gearbox/static/js/vendor/xterm-addon-search.min.js | Vendored xterm search addon bundle for in-terminal find. |
| gearbox/static/js/console/console.js | Implements search wiring, paste-confirm interception, global shortcut handler, and tab rename behavior. |
| gearbox/static/css/components/console.css | Styles for rename input, search bar, and paste-confirm modal. |
| gearbox/internal/framework/templates/components/console.templ | Adds search bar + paste modal markup and includes the search addon script. |
- Global Ctrl-Shift-` shortcut now reads the correct cookie name
(gearbox_active_box, not box_id) and wires eagerly on
DOMContentLoaded so it works before the user has opened the
console once.
- Add .console-search-bar.hidden and .console-paste-modal.hidden to
the .hidden specificity-override block; Tailwind's .hidden was
losing the cascade tie to our component display rules.
- Paste threshold now counts actual newline characters (>= 20)
rather than split('\n').length, removing the off-by-one and the
trailing-newline edge case. Visible "N lines" label reads
newlines + 1 to match how users count.
- Confirmed paste routes through term.paste(text) so xterm applies
its normal paste pipeline including bracketed-paste wrapping
(ESC[200~ ... ESC[201~) when the remote shell has DECSET 2004
enabled. Direct sendText was bypassing that.
- Drop dead CSS rules targeting .xterm-decoration.console-search-*.
The xterm-addon-search uses its own class names
(xterm-find-result-decoration / xterm-find-active-result-decoration)
and we already pass decorations.{activeMatchBackground,matchBackground}
options in JS, so the CSS was unreachable.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Cluster 1 of #142 — quality-of-life additions to the multi-session console.
Ctrl-F/Cmd-F). Vendored@xterm/addon-search@0.15.0; each session lazy-loads its own search addon on first use. Search bar shows prev/next, live match count (3 / 12), Esc to close.attachCustomKeyEventHandlerintercepts Ctrl-F before xterm forwards it to the shell.ConsoleSession.sendTextpath; Cancel discards. The bracketed paste handshake itself is already owned by the remote shell (DECSET 2004) — xterm wraps withESC[200~ … ESC[201~automatically when asked.Ctrl-Shift-`opens a console for the currently active box (reads thebox_idcookie set byswitchBox). No-op if no box is pinned — the command palette is the fallback.session.baseLabelstill carries the canonical box name for tooltips and the#Ndisambiguation when duplicates exist.Test plan
#1/#2suffix logic working when applicable.Refs #142.
🤖 Generated with Claude Code