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:
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../core/api_gateway.dart';
|
||||
import '../../ui/input/keyboard_owner.dart';
|
||||
import '../../ui/motion/motion.dart';
|
||||
import 'terminal_focus.dart';
|
||||
import 'terminal_hub.dart';
|
||||
@@ -81,6 +82,9 @@ class _TerminalSurfaceState extends State<TerminalSurface>
|
||||
bool _panelShown = false;
|
||||
String? _selected;
|
||||
|
||||
/// The key of the toggle chord held down, if any.
|
||||
PhysicalKeyboardKey? _toggleKey;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -150,8 +154,21 @@ class _TerminalSurfaceState extends State<TerminalSurface>
|
||||
KeyEventResult _key(KeyEvent event) {
|
||||
if (!mounted) return KeyEventResult.ignored;
|
||||
final keyboard = HardwareKeyboard.instance;
|
||||
if (terminalToggleShortcut(event, keyboard)) {
|
||||
if (event is KeyDownEvent) toggle();
|
||||
// A held toggle chord's repeats stay swallowed after the terminal it
|
||||
// showed takes the keyboard (where Alt+T and Ctrl+T are the shell's).
|
||||
if (event.physicalKey == _toggleKey) {
|
||||
if (event is KeyUpEvent) _toggleKey = null;
|
||||
if (event is KeyRepeatEvent) return KeyEventResult.handled;
|
||||
}
|
||||
if (terminalToggleShortcut(
|
||||
event,
|
||||
keyboard,
|
||||
inTerminal: primaryFocusIsTypingSurface(),
|
||||
)) {
|
||||
if (event is KeyDownEvent) {
|
||||
_toggleKey = event.physicalKey;
|
||||
toggle();
|
||||
}
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
final step = terminalTabShortcut(event, keyboard);
|
||||
|
||||
Reference in New Issue
Block a user