From 287ca3a7cb8a351e5cae1b2480fbe2baf42e2fc8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 11 Jul 2026 00:02:50 -0500 Subject: fix(keyboard-compat): register terminal arrow-key setup on tty-setup-hook The arrow-key decodings ran on emacs-startup-hook, but input-decode-map is terminal-local and a daemon's startup hook fires once with no tty. So every emacsclient -t frame opened later missed the decodings, and arrow keys broke in terminal frames. tty-setup-hook runs for each new tty frame, daemon and non-daemon alike. The GUI half already frame-scopes itself. A test pins the hook so a regression back to emacs-startup-hook fails. --- tests/test-keyboard-compat-setup.el | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/test-keyboard-compat-setup.el b/tests/test-keyboard-compat-setup.el index 1c5cd434..a3e6f441 100644 --- a/tests/test-keyboard-compat-setup.el +++ b/tests/test-keyboard-compat-setup.el @@ -61,6 +61,14 @@ string can return a meta-prefix event count rather than nil.)" (cj/keyboard-compat-terminal-setup) (should (equal input-decode-map (make-sparse-keymap))))) +(ert-deftest test-keyboard-compat-terminal-setup-on-tty-setup-hook () + "Normal: terminal setup is registered on `tty-setup-hook', which runs for each +new tty frame. `input-decode-map' is terminal-local, so `emacs-startup-hook' +\(once, at daemon start, with no tty) leaves every later `emacsclient -t' frame +without the arrow-key decodings. The GUI half already frame-scopes itself." + (should (memq 'cj/keyboard-compat-terminal-setup tty-setup-hook)) + (should-not (memq 'cj/keyboard-compat-terminal-setup emacs-startup-hook))) + ;; -------------------------- cj/keyboard-compat-gui-setup --------------------- (defmacro test-kbc--gui (gui-p &rest body) -- cgit v1.2.3