Terminal: find field takes the keyboard; docs, capture kit right-click

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 00:52:19 +00:00
parent e65354496a
commit 9ab7f50cce
7 changed files with 101 additions and 3 deletions
+63
View File
@@ -109,6 +109,69 @@ tmux inside it for work that must survive that).
terminal is opened): each connection sends one request at a time, so the
first screen's read is never queued behind `terminal_list`.
## View features (round 2, 2026-11-26)
Shared by the permanent terminal and chat terminal cards
(`ChatShellTerminalView`); client-side only, no server change. The view's
own keys are answered before the key→byte mapping
(`chatShellLocalKey`, `chat_shell_terminal_shortcuts.dart`):
- **Find in scrollback:** Cmd+F (Apple) / Ctrl+Shift+F (elsewhere; Ctrl+F
stays the shell's forward-char) opens a find bar over the terminal's top
end, or focuses it. Typing searches the whole buffer, wrapped rows joined
(`chat_shell_terminal_search.dart`, at most 1000 matches, "1000+"); every
match is highlighted (controller highlights, the emulator's existing
hook) and the current one more strongly, scrolled into view. It starts
at the newest match; Enter / the down arrow is next, Shift+Enter / up is
previous, wrapping; **Aa** toggles Match case; Esc or × closes it and
gives the terminal the keyboard back. Output arriving meanwhile marks
the result stale; the next step searches again.
- **Text size:** Cmd (Apple) / Ctrl with `=`/`+` and `-` zoom one point,
with `0` back to the default; Settings → Appearance → Terminal → Text size
too. Saved with the layout (`font_size`, 8–32). The view relays out at
the new cell size, so the PTY is resized through the normal resize path.
Note Ctrl+- is readline's undo (`^_`) in xterm; here it zooms.
- **Scrollback:** Settings → Scrollback (1k, 5k, 10k default, 25k, 50k,
100k lines; saved as `scrollback`). It applies at once to open terminals
(`Terminal.maxLines` is settable; shrinking drops the oldest lines).
- **Scrolling keys:** on the main screen Shift+PgUp / Shift+PgDn scroll one
screen (keeping a line), Shift+Home / Shift+End to the top / bottom,
locally. On the alternate screen (less, vim) they reach the program.
- **Context menu:** a right-click offers Copy (with a selection), Paste
(live terminals), Select all (scrollback included), Clear scrollback
(this view's copy; the server keeps the output) and Find…. A program
that tracks the mouse gets the right button instead, unless Shift is
held. On the web the browser's own menu is suppressed while the pointer
is over the terminal (`ChatShellNoBrowserMenu`, the chat links'
`suppressBrowserMenuOverLink`).
- **Bell:** BEL flashes the terminal's border in the accent colour
(300 ms fade; held then gone under reduced motion). A bell while no view
shows the terminal (another tab selected, or the terminal hidden) dots
its tab until it is shown. Settings → Visual bell turns both off.
- **Links:** hovering an OSC 8 hyperlink (by its target, `hyperlinkAt`) or
a printed http(s) address shows a pointer cursor and underlines the
link's cells; a click opens it as before.
- **OSC 52:** a program setting the clipboard copies to the system
clipboard and shows "Copied from terminal" (reads are never answered).
**OSC 7:** the reported folder names an untitled tab and its tooltip.
A replay (reload, reconnect) of old output neither copies nor rings.
- **Cursor blink:** a blinking DECSCUSR shape (odd Ps) blinks (530 ms
phases) on a ticker that runs only while the terminal is focused and
motion is not reduced; output or typing shows it again at once.
- **Stale selection:** a selection clears when its rows on screen are
rewritten or erased, the screen is cleared, its lines drop out of the
scrollback, or the program switches screens.
Evidence: tests `test/features/chat/shell/chat_shell_terminal_{find,
local_keys,menu,events,feedback}_test.dart`, `test/features/terminal/
terminal_tab_events_test.dart`, `test/features/settings/
settings_terminal_controls_test.dart`, `test/third_party_xterm/
scrollback_blink_test.dart`. Chrome captures (capture kit, `?terminals=1
&terminal=panel`, 1200x800): find bar with "2 of 2" PASS highlights,
context menu, Ctrl+= zoom, OSC 8 link hover underline; a synthetic
`contextmenu` event over the terminal is default-prevented, elsewhere not.
The capture kit gained `rightclick=<target>`.
## Protocol (server)
`internal/protocol/terminal.go`; documented in `docs/cli.md` ("Machine