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
@@ -265,6 +265,39 @@ void main() {
expect(layout.mode, TerminalMode.panel);
});
Future<void> pumpSettings(WidgetTester tester) => tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SingleChildScrollView(
child: SettingsTerminalSection(layout: layout),
),
),
),
);
const optionAsMeta = ValueKey('settings-terminal-option-as-meta');
desktopTestWidgets('on a Mac, Settings chooses whether Option is Meta, '
'saved with the layout', (tester) async {
await pumpSettings(tester);
expect(layout.optionAsMeta, isTrue);
await tester.tap(find.byKey(optionAsMeta));
await tester.pumpAndSettle();
expect(layout.optionAsMeta, isFalse);
expect(saved()['option_as_meta'], isFalse);
final restored = TerminalLayout(store: store);
await restored.restore();
expect(restored.optionAsMeta, isFalse);
});
testWidgets(
'elsewhere Alt is always Meta and there is no Option switch',
(tester) async {
await pumpSettings(tester);
expect(find.byKey(optionAsMeta), findsNothing);
},
variant: TargetPlatformVariant.only(TargetPlatform.linux),
);
desktopTestWidgets(
'a narrow window opens the terminal full screen with the key '
'toolbar',