Terminal: xterm key encoding, no live reflow on resize, Alt+T/Ctrl+T reach the shell

- Live terminals no longer reflow (xterm.dart 4.0.0 left the cursor on the
  wrong row); narrowing cuts and erases cells past the width, rows scroll
  into scrollback keeping the cursor row; finished output still reflows.
- App-side key encoding before xterm.dart's defaults: Alt as Meta (ESC +
  the typed character), Ctrl symbol table, xterm modifier parameter for
  arrows/Home/End/PgUp/PgDn/Ins/Del/F-keys, DECCKM and DECKPAM, Alt+BS.
- Settings > Appearance > Terminal: Use Option as Meta key (Macs, on).
- Inside a focused terminal only Cmd+T and Ctrl+` toggle it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 23:32:29 +00:00
parent 5ab1ec9e00
commit 7d1ffe8ad3
22 changed files with 1408 additions and 61 deletions
@@ -208,9 +208,11 @@ class KeyboardShortcutRegistry {
web: web,
platform: platform,
).toggle.join(', '),
caveat: web
? 'Browser tab shortcuts such as Cmd+T are not available to the app.'
: null,
caveat: [
TerminalShortcutLabels(web: web, platform: platform).inTerminalNote,
if (web)
'Browser tab shortcuts such as Cmd+T are not available to the app.',
].join(' '),
),
if (!web)
const KeyboardShortcutEntry(
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../terminal/terminal_layout.dart';
@@ -63,6 +64,20 @@ class SettingsTerminalSection extends StatelessWidget {
),
),
),
// Alt is always Meta elsewhere; only a Mac's Option types symbols.
if (defaultTargetPlatform == TargetPlatform.macOS ||
defaultTargetPlatform == TargetPlatform.iOS)
SwitchListTile(
key: const ValueKey('settings-terminal-option-as-meta'),
title: const Text('Use Option as Meta key'),
subtitle: const Text(
'Option+B, Option+F and Option+D move and delete by word in '
'the shell (ESC b, ESC f, ESC d). Off, Option types its '
'symbol (∫, ƒ, ∂).',
),
value: layout.optionAsMeta,
onChanged: layout.setOptionAsMeta,
),
],
);
},