Terminal round 3: readable palettes, panel and card sizing, rail, tabs

- Colours: terminal background is the theme's lowest surface; the 16 ANSI
  colours come from a chosen palette (Theme colours, Classic, Calm, Vivid;
  Settings > Terminal > Colours, saved as `palette`) adjusted in lightness
  to the background: colours 4.5:1, bright ones lighter than normal,
  white light and black dark in both themes so white-on-red/blue/magenta
  and black-on-green/yellow/cyan (ls setuid, setgid, sticky) keep 3:1.
  Selection, find matches and the current match keep text at 4.5:1.
- Bottom panel opens at 40% of the window, at least 16 rows, until
  dragged; the dragged height is remembered (old saved 300 px default
  reads as never resized).
- Navigation rail scrolls its tabs (and below 240 px Settings too), so
  items never overlap under a tall panel.
- Chat command cards: Expand / Collapse grows a live terminal to 60% of
  the window (finished output only to its rows); collapsed stays 12 rows.
- Terminal tabs: ellipsised titles (220 px) with the whole title in the
  tooltip, selected tab filled, outlined and bold, close buttons are
  IconButtons (48 px touch, 40 px desktop).
- Capture fixture: ?terminalColors=1 and ?terminalPalette=.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 02:25:16 +00:00
parent e526150b1e
commit b59ab5fad7
27 changed files with 1141 additions and 145 deletions
+50 -5
View File
@@ -68,9 +68,15 @@ tmux inside it for work that must survive that).
emulator is not resized during the motion); the floating window scales
from 92 % and fades in its own place. During the hide motion the terminal
stays mounted but takes no pointer or focus (`terminal_stage.dart`).
- **Bottom panel:** resized by dragging its top edge (the app's
`AdaptiveResizeGrip`; arrow keys too, slider semantics); its height is
remembered. The panel always leaves the app at least 160 px.
- **Bottom panel:** opens at 40 % of the window, and at least 16 terminal
rows (`terminalPanelDefaultHeight`), until the operator resizes it by
dragging its top edge (the app's `AdaptiveResizeGrip`; arrow keys too,
slider semantics); the dragged height is remembered (`panel_height`; a
layout saved with the old fixed 300 px default reads as never resized).
The panel always leaves the app at least 160 px. The destination rail
beside the app scrolls its tabs when the panel leaves it too little
height, and below 240 px Settings scrolls with them instead of staying
pinned, so rail items never overlap.
- **Floating window:** dragged by its title bar, resized from its lower
right corner, double-click or Maximise fills the app (8 px margin),
Minimise collapses it to its title bar, × hides it. Frame and state are
@@ -172,6 +178,43 @@ 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>`.
## Theme and layout polish (round 3, 2026-11-26)
- **Colours** (`chat_shell_terminal_palette.dart`, `chat_shell_terminal_theme.dart`):
the terminal's background is the theme's lowest surface (white in light,
near-black in dark), the foreground the body text colour. Settings →
Terminal → Colours offers *Theme colours* (the emulator's standard
palette, default), *Classic* (Tango-like), *Calm* (Solarized-like) and
*Vivid* (One-like), saved as `palette`. Every palette is adjusted to the
background by moving each colour's lightness only as far as needed:
red to cyan at 4.5:1 on the background (bright ones 4.5:1 dark, 3:1
light, and lighter than their normal colour), bright black 3:1, white
light and black dark in both themes so white text on red, blue and
magenta (`ls` setuid, dialogs) and black text on green, yellow and cyan
(setgid, sticky, status bars) keep 3:1. As in other terminals, white
text on a light background and black on a dark one stay faint, and
colour-on-colour pairs such as `ls` other-writable (blue on green) are
not guaranteed.
- **Selection and find:** selection is the accent at 35 %, find matches the
tertiary colour at 20 % and the current match at 40 %; all are painted
over the text and keep it at 4.5:1. The block cursor (accent) keeps 4.5:1
with the character it redraws in the background colour.
- **Tabs** (`terminal_tab_chip.dart`): titles ellipsise at 220 px with the
whole title, machine and folder in the tooltip; the selected tab is
filled, outlined in the accent and bold; the close button is a standard
`IconButton` (48 px on touch, 40 px on desktops).
- **Chat command cards:** collapsed they keep 12 rows; **Expand** (shown
for a live terminal, or output longer than 12 rows) grows the terminal
to 60 % of the window's height (`kChatShellOutputExpandedFraction`; a
finished run only to its output), and **Collapse** returns.
- Evidence: tests `test/features/chat/shell/chat_shell_terminal_palette_test.dart`
(contrast of every palette in both themes), `test/features/terminal/
terminal_panel_layout_test.dart`, `test/shell/navigation_rail_test.dart`
(no overlap at 160-800 px), `chat_shell_run_card_test.dart` (Expand),
`settings_terminal_controls_test.dart` (Colours). Capture fixture
`?terminalColors=1` prints the palette, backgrounds and `ls` pairs in the
home terminal; `?terminalPalette=classic|calm|vivid` picks a palette.
## Protocol (server)
`internal/protocol/terminal.go`; documented in `docs/cli.md` ("Machine
@@ -490,7 +533,7 @@ software) costs about 2 ms more raster. Runs on this machine vary by about
`websocket.go`, `cmd/pipelines-server/main.go`; tests `terminal_ws_test.go`,
`terminal_login_test.go`, `terminal_lifetime_test.go`, `terminal_legacy_tmux_test.go`,
`internal/pipeline/terminals_test.go`; `docs/cli.md`.
- App: `lib/features/terminal/` (`terminal_{info,stream,tab,hub,listing,machines,layout,scope,surface,stage,focus,shortcuts,panel,float,float_frame,page,body,tab_strip,menu,toggle_button,open_action}.dart`),
- App: `lib/features/terminal/` (`terminal_{info,stream,tab,hub,listing,machines,layout,scope,surface,stage,focus,shortcuts,panel,float,float_frame,page,body,tab_strip,tab_chip,menu,toggle_button,open_action}.dart`),
`lib/application/app_terminals.dart`, `pipelines_app.dart`,
`bootstrap.dart`, `lib/shell/adaptive_shell.dart` (`barActions`),
`lib/features/settings/settings_terminal_section.dart` (+ screen/topic
@@ -500,7 +543,9 @@ software) costs about 2 ms more raster. Runs on this machine vary by about
made public), `lib/features/chat/chat_screen_workspace.dart` (Ctrl+Tab
yields to a shown terminal). Tests `test/features/terminal/`. Probe fixture
`tool/perf/terminal_fixture.dart` (`?terminals=1`, `?terminal=panel|float`,
showcases `?terminalAttrs=1`, `?terminalUnicode=1`).
showcases `?terminalAttrs=1`, `?terminalUnicode=1`, `?terminalColors=1`,
`?terminalPalette=`). Colours: `lib/features/chat/shell/chat_shell_terminal_{theme,palette}.dart`;
rail: `lib/shell/navigation_rail.dart`.
- Emulator Unicode and drawing: `third_party/xterm/lib/src/utils/unicode_{width,tables}.dart`,
`core/buffer/{graphemes,grapheme_join}.dart`, `ui/{cell_glyphs,text_runs,row_pictures,painter}.dart`,
`third_party/xterm/tool/gen_unicode_tables.py`; tests