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:
@@ -25,14 +25,20 @@ tmux inside it for work that must survive that).
|
||||
own login and asks for the password again.
|
||||
- **Shortcuts** (`terminal_shortcuts.dart`, handled by the surface as a
|
||||
`FocusManager` early key handler, so they work wherever focus is, including
|
||||
inside the terminal and in the chat composer, and neither receives the key):
|
||||
in the chat composer, which does not receive the key):
|
||||
- **Alt+T** (Option+T), **Ctrl+T**, **Cmd+T** (Meta+T) and **Ctrl+`**
|
||||
show or hide the terminal in the selected mode; on a narrow window they
|
||||
open and close the full-screen page. Only the one modifier counts
|
||||
(Ctrl+Shift+T, Ctrl+Alt+T pass through); Option+T, which types † on a
|
||||
Mac, is also matched by key position. Cmd+` stays the macOS window
|
||||
switcher. **The shell's own Ctrl+T (transpose-chars) no longer reaches
|
||||
it** while this binding is on.
|
||||
switcher.
|
||||
- **Inside a focused terminal** (any `TypingSurface`, i.e. a terminal
|
||||
view) only **Cmd+T** and **Ctrl+`** toggle: **Ctrl+T** reaches the shell
|
||||
as `^T` (transpose-chars) and **Alt+T** as `ESC t` (transpose-words).
|
||||
A held chord that opened the terminal from outside keeps its repeats
|
||||
swallowed after the terminal takes the keyboard, so nothing is typed.
|
||||
The ⋮ menu and the shortcut cheatsheet say so
|
||||
(`TerminalShortcutLabels.inTerminalNote`).
|
||||
- **Ctrl+Tab / Ctrl+Shift+Tab**, while the terminal is shown (panel,
|
||||
window or narrow page), select the next / previous terminal tab, wrapping,
|
||||
and focus it. This deliberately overrides the chat's Ctrl+Tab pane
|
||||
@@ -89,9 +95,16 @@ tmux inside it for work that must survive that).
|
||||
from its retained output. A dropped connection resumes after the last
|
||||
byte held. A restarted server lists the terminals as ended, with why.
|
||||
- **Keyboard:** a focused terminal gets every key (Ctrl-C, Esc, Tab, arrows,
|
||||
Ctrl-letters) except the shortcuts above (Ctrl+T, Alt+T, Cmd+T, Ctrl+`,
|
||||
and Ctrl+Tab while shown); paste is Cmd-V (Apple) or Ctrl-V/Ctrl-Shift-V. Clicking
|
||||
elsewhere moves focus away normally.
|
||||
Ctrl-letters, Ctrl+T, Alt+T) except Cmd+T, Ctrl+` and Ctrl+Tab while
|
||||
shown; paste is Cmd-V (Apple) or Ctrl-V/Ctrl-Shift-V. Clicking elsewhere
|
||||
moves focus away normally. Keys are encoded as xterm does; see
|
||||
`chat-interactive-terminal.md` (Keys). **Option as Meta** (Settings →
|
||||
Appearance → Terminal, Macs only, saved with the layout, default on): a
|
||||
Mac's Option sends `ESC` + the key's character (Option+B = `ESC b`)
|
||||
instead of typing its symbol (∫). On by default because the shell's
|
||||
Meta bindings (word motion, transpose, yank-last-arg) are used far more
|
||||
in a terminal than Option's symbols; turn it off to type them. Other
|
||||
platforms' Alt is always Meta.
|
||||
- No terminal request is sent until the terminal is first shown (or a
|
||||
terminal is opened): each connection sends one request at a time, so the
|
||||
first screen's read is never queued behind `terminal_list`.
|
||||
@@ -391,3 +404,26 @@ The tmux results above (restart survival, client replacement, the
|
||||
service outlived it and was killed by hand.
|
||||
- Not verified: logging in for real (needs the operator's password), Linux
|
||||
su, and the app against a live server in a browser (widget tests only).
|
||||
|
||||
### Terminal input and resize fixes, round 1 (2026-11-25)
|
||||
|
||||
- Resize: live terminals run with `reflowEnabled: false`; the old
|
||||
blank-row-trimming `resize` override now applies only to finished
|
||||
(reflowing) output, and narrowing erases cells past the new width.
|
||||
Tests: `test/features/chat/shell/chat_shell_terminal_resize_test.dart`
|
||||
(long lines shrink/grow with the prompt on the cursor row, shell redraw
|
||||
and command output after shrinking, no stale text after widening, cleared
|
||||
screen and scrollback stay cleared, a view whose box shrinks and grows).
|
||||
- Keys: xterm encoding for Alt/Meta, Ctrl symbols, modified special keys,
|
||||
DECCKM and DECKPAM (`chat-interactive-terminal.md`, Keys); Option as Meta
|
||||
setting. Tests: `chat_shell_terminal_input_test.dart` (key event to
|
||||
bytes, Linux and macOS variants, setting on and off, toolbar `keyInput`),
|
||||
`chat_shell_terminal_test.dart` (keys through the real view, Ctrl-V paste
|
||||
intact), `terminal_surface_test.dart` (setting saved and restored, hidden
|
||||
off Apple platforms).
|
||||
- Shortcuts: inside a terminal Alt+T and Ctrl+T reach the shell; Cmd+T
|
||||
and Ctrl+` still toggle (`terminal_shortcuts_test.dart`).
|
||||
- Not verified: bytes against a real PTY in a browser or native build after
|
||||
the change (widget tests only), real macOS Option events (native and
|
||||
browser logical-key shapes are assumed as the tests model them), AltGr on
|
||||
a real non-US Linux/Windows layout.
|
||||
|
||||
Reference in New Issue
Block a user