Skip to content

feat(console): cluster 1 polish — search, paste guard, shortcut, tab rename - #143

Merged
sarg3nt merged 2 commits into
mainfrom
feature/console-cluster1-142
May 18, 2026
Merged

feat(console): cluster 1 polish — search, paste guard, shortcut, tab rename#143
sarg3nt merged 2 commits into
mainfrom
feature/console-cluster1-142

Conversation

@sarg3nt

@sarg3nt sarg3nt commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

Cluster 1 of #142 — quality-of-life additions to the multi-session console.

  • Find in buffer (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. attachCustomKeyEventHandler intercepts Ctrl-F before xterm forwards it to the shell.
  • Large-paste confirm: pastes with ≥ 20 newlines pop an inline modal with a preview (first 30 lines / 1200 chars capped). Confirm pipes the text into the active session's PTY via the new ConsoleSession.sendText path; Cancel discards. The bracketed paste handshake itself is already owned by the remote shell (DECSET 2004) — xterm wraps with ESC[200~ … ESC[201~ automatically when asked.
  • Global open-console shortcut: Ctrl-Shift- ` opens a console for the currently active box (reads the box_id cookie set by switchBox). No-op if no box is pinned — the command palette is the fallback.
  • Tab rename: double-click a tab label to swap it for an inline text input. Blur or Enter commits; Escape reverts. Per-session, scoped to the session's lifetime — session.baseLabel still carries the canonical box name for tooltips and the #N disambiguation when duplicates exist.

Test plan

  • Open a console; Ctrl-F brings up the find bar; typing highlights matches in xterm; Enter advances, Shift-Enter goes back, count updates ("3 / 12"); Esc closes and clears decorations.
  • Paste a 5-line snippet — flows directly into the shell (no modal).
  • Paste a 30-line snippet — modal appears with line count + preview; Cancel discards, Confirm sends the full content.
  • With the bx-grid box selected (cookie set), Ctrl-Shift-` opens a console for that box from anywhere in the app.
  • Double-click a tab label — rename input replaces the label; Enter commits the new name, Escape reverts to the original; tooltip on hover still shows the original box name + status.
  • Two tabs to the same box rename one; the other keeps #1 / #2 suffix logic working when applicable.
  • All existing console behavior intact: dock, popout, font slider, status dots, +-new-tab.

Refs #142.

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings May 18, 2026 07:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread gearbox/static/js/console/console.js
Comment thread gearbox/static/css/components/console.css
Comment thread gearbox/static/js/console/console.js Outdated
Comment thread gearbox/static/js/console/console.js Outdated
Comment thread gearbox/static/css/components/console.css Outdated
Comment thread gearbox/static/js/console/console.js
- 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>
@sarg3nt
sarg3nt merged commit 10f939e into main May 18, 2026
22 checks passed
@sarg3nt
sarg3nt deleted the feature/console-cluster1-142 branch May 28, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants