From 802de4f12f125abc261c58bdb5385f6be3ad469a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 09:43:37 -0300 Subject: Shift-Esc always backs out: in every mode and pane it goes to the previous pane, as Esc does from normal, and a raw program never sees it; Ctrl-b alone toggles raw Shift-Esc switched a terminal in normal or insert mode into raw, so the one key meant to get out of anything got a script or a person into a program instead. It is now handled before any mode: an open prompt is closed, insert mode left, a pending count dropped, and Last runs, the pane keeping its mode (a raw terminal stays raw). Ctrl-b is the only switch between raw and normal. The keymap's two chords become one, back_out; the cheatsheet row, the guide's mode table and the tutor say so, and the tty and builtins goldens are re-recorded. Co-Authored-By: Claude Opus 5.5 --- test/snapshots/tty.snap | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'test/snapshots/tty.snap') diff --git a/test/snapshots/tty.snap b/test/snapshots/tty.snap index 6ce0d5ba..48fffbd1 100644 --- a/test/snapshots/tty.snap +++ b/test/snapshots/tty.snap @@ -1,11 +1,8 @@ -# tty mode round-trip: Ctrl-b in, run a command, Ctrl-b out. Shift-Esc (CSI -# 27;2u — needs a host that reports modifiers on Escape) also gets you IN; a -# PLAIN Esc does not, it still goes to the shell. -# -# Getting OUT is Ctrl-b alone. Shift-Esc in tty is what Escape is in normal -# mode instead — Last, the pane you were in before this one — leaving this pane -# in tty so coming back lands in the program you left. The hop itself is -# covered by a unit test in pardes.zig. +# tty mode round-trip: Ctrl-b in, run a command, Ctrl-b out. Ctrl-b is the one +# switch between raw and normal. Shift-Esc (CSI 27;2u — needs a host that +# reports modifiers on Escape) never switches: in every mode it is what Escape +# is in normal mode — Last, the pane you were in before this one — and a raw +# terminal stays raw. The hop itself is covered by a unit test in pardes.zig. file m.txt marker start 31 100 -n 3 wait 8000 m.txt @@ -21,16 +18,14 @@ snap tty-echo key c-b stable 600 8000 snap tty-off -# Shift-Esc: in, the same as Ctrl-b... +# Shift-Esc from normal: never into raw; it backs out to the previous pane. send \e[27;2u stable 600 8000 -snap shift-esc-on -# ...but not out. With no doc pane to hop to it changes nothing: still tty, -# prompts still shown, same pane focused. -send \e[27;2u +snap shift-esc-normal +# Ctrl-b is the switch: into raw, and out again. +key c-b stable 600 8000 -snap shift-esc-nodoc -# Ctrl-b still leaves tty in place, which is now the only thing that does. +snap ctrl-b-on key c-b stable 600 8000 snap ctrl-b-off -- cgit v1.3