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
@@ -75,6 +75,11 @@ class TerminalLayout extends ChangeNotifier {
Rect floatRect = terminalFloatDefaultRect;
bool maximized = false;
/// Whether a Mac's Option key is Meta in the terminal (Option+B sends
/// ESC b, readline's word back) rather than typing its symbol (∫). Other
/// platforms' Alt is always Meta.
bool optionAsMeta = true;
/// Whether the last change could not be saved.
bool saveFailed = false;
@@ -100,6 +105,7 @@ class TerminalLayout extends ChangeNotifier {
}
}
maximized = json['maximized'] == true;
optionAsMeta = json['option_as_meta'] != false;
} catch (_) {
return;
}
@@ -107,6 +113,7 @@ class TerminalLayout extends ChangeNotifier {
}
void setMode(TerminalMode value) => _change(() => mode = value);
void setOptionAsMeta(bool value) => _change(() => optionAsMeta = value);
void toggle() => _change(() => visible = !visible);
void show() => _change(() => visible = true);
void hide() => _change(() => visible = false);
@@ -128,6 +135,7 @@ class TerminalLayout extends ChangeNotifier {
floatRect.height,
],
'maximized': maximized,
'option_as_meta': optionAsMeta,
}),
);
if (revision != _revision || saved != saveFailed) return;