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
@@ -6,6 +6,7 @@ import '../../../ui/text/monospace.dart';
import '../conversation/chat_card_styles.dart';
import 'chat_shell_card_actions.dart';
import 'chat_shell_dismiss.dart';
import 'chat_shell_metrics.dart';
import 'chat_shell_output_view.dart';
import 'chat_shell_run.dart';
import 'chat_shell_runs_controller.dart';
@@ -38,8 +39,20 @@ class ChatShellRunCard extends StatefulWidget {
class _ChatShellRunCardState extends State<ChatShellRunCard> {
bool _fullScreen = false;
bool _expanded = false;
int _viewGeneration = 0;
/// Whether expanding would show more: a live terminal grows to the
/// window; other output only if it has more rows than the collapsed box
/// (at the width it was laid out at).
bool _expandable(ChatShellRun run) {
if (!run.running && run.output.isEmpty) return false;
final session = widget.controller.terminals.session(run);
return session.live ||
session.rowsAt(session.terminal.viewWidth) >
kChatShellOutputCollapsedLines;
}
Future<void> _openFullScreen() async {
setState(() => _fullScreen = true);
await openChatShellTerminalPage(
@@ -127,6 +140,7 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
controller: controller,
viewKey: ValueKey<int>(_viewGeneration),
fullScreen: _fullScreen,
expanded: _expanded,
),
if (run.error.isNotEmpty && !run.running)
Padding(
@@ -138,6 +152,10 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
run: run,
controller: controller,
onFullScreen: () => _openFullScreen(),
expanded: _expanded,
onExpand: _expanded || _expandable(run)
? () => setState(() => _expanded = !_expanded)
: null,
),
if (error != null)
Semantics(