diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-26 05:37:25 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-26 05:37:25 -0400 |
| commit | 1f10ea49e33c5f09a43e95bc30e818899bf4826d (patch) | |
| tree | 9b8247d12c9afb88376deb84c858e73be89f9f8b /tests | |
| parent | 108512df855a83cb98f330ee6cf6f22168c0d76d (diff) | |
| download | dotemacs-1f10ea49e33c5f09a43e95bc30e818899bf4826d.tar.gz dotemacs-1f10ea49e33c5f09a43e95bc30e818899bf4826d.zip | |
fix(eat): make Escape the unified copy-mode exit
EAT's semi-char mode left the bare escape key unbound and treated ESC only as the Meta prefix, so a lone Escape never reached the pty. That is why C-<up>'s tmux copy-mode could not be exited with Escape: tmux's own Escape=cancel binding never saw the key. Bind <escape> to forward ESC to the terminal, so it cancels tmux copy-mode and still works in TUIs like vim. Also bind <escape> in eat-mode-map to return to semi-char, so the same key exits EAT's own emacs and char modes. One exit key for both copy views; q is no longer required.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-term-tmux-history.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test-term-tmux-history.el b/tests/test-term-tmux-history.el index 633d7a02c..c7154e5d2 100644 --- a/tests/test-term-tmux-history.el +++ b/tests/test-term-tmux-history.el @@ -273,5 +273,20 @@ up-arrow -- it does not re-enter and reset the cursor." (should (eq (keymap-lookup eat-semi-char-mode-map "C-<up>") #'cj/term-copy-mode-up))) +(ert-deftest test-term-escape-bound-as-unified-exit () + "Normal: Escape sends ESC in semi-char mode (cancels tmux copy-mode) and +returns to semi-char from EAT's emacs/char mode -- one exit key for both." + (should (eq (keymap-lookup eat-semi-char-mode-map "<escape>") + #'cj/term-send-escape)) + (should (eq (keymap-lookup eat-mode-map "<escape>") #'eat-semi-char-mode))) + +(ert-deftest test-term-send-escape-writes-esc-to-pty () + "Normal: `cj/term-send-escape' sends a bare ESC to the terminal process." + (let ((sent nil)) + (cl-letf (((symbol-function 'cj/--term-send-string) + (lambda (s) (push s sent)))) + (cj/term-send-escape) + (should (equal sent '("\e")))))) + (provide 'test-term-tmux-history) ;;; test-term-tmux-history.el ends here |
