From ebdf9e466b0e1f86e9b7d76650ac32408273e7a7 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 5 Jun 2026 05:28:58 -0500 Subject: feat(term): replace vterm with ghostel as the terminal engine I swapped the terminal engine from vterm to ghostel (libghostty-vt) everywhere. term-config replaces vterm-config (the F12 terminal, the C-; x menu, tmux history capture), and ai-term replaces ai-vterm (the F9 Claude-agent launcher). ghostel renders the agent TUI without vterm's flicker under heavy streaming, and one engine now covers every terminal workflow. Two behavior changes fall out of the swap. F9 launches in a terminal frame now: ghostel renders in TTY frames, so the old GUI-only guard is gone. Terminal windows no longer dim when unfocused: ghostel resolves its palette into the native module per-terminal, so there's no per-window color hook to dim through the way vterm had. auto-dim drops its vterm color-advice path, the dashboard Terminal button launches ghostel, and the vterm and vterm-toggle packages are removed. The tmux pane-history and copy-mode machinery carried over unchanged. It keys on the pty tty, which ghostel exposes. --- tests/test-term-toggle--dispatch.el | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/test-term-toggle--dispatch.el (limited to 'tests/test-term-toggle--dispatch.el') diff --git a/tests/test-term-toggle--dispatch.el b/tests/test-term-toggle--dispatch.el new file mode 100644 index 00000000..f13c2840 --- /dev/null +++ b/tests/test-term-toggle--dispatch.el @@ -0,0 +1,53 @@ +;;; test-term-toggle--dispatch.el --- Tests for cj/--term-toggle-dispatch -*- lexical-binding: t; -*- + +;;; Commentary: +;; Pure decision helper for F12. Returns one of (toggle-off . WIN), +;; (show-recent . BUFFER), or (create-new) based on whether a terminal +;; window is currently displayed and whether any terminal buffers are +;; alive. Mocking the underlying helpers keeps the dispatch logic +;; exercisable without touching real windows. + +;;; Code: + +(require 'ert) +(require 'cl-lib) + +(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) +(add-to-list 'load-path (expand-file-name "tests" user-emacs-directory)) +(require 'term-config) +(require 'testutil-ghostel-buffers) + +(ert-deftest test-term-toggle--dispatch-window-displayed-returns-toggle-off () + "Normal: displayed terminal window -> (toggle-off . WIN)." + (let ((sentinel-win 'fake-window)) + (cl-letf (((symbol-function 'cj/--term-toggle-displayed-window) + (lambda (&optional _frame) sentinel-win))) + (should (equal (cj/--term-toggle-dispatch) + (cons 'toggle-off sentinel-win)))))) + +(ert-deftest test-term-toggle--dispatch-no-window-buffer-alive-returns-show-recent () + "Normal: no displayed terminal, at least one alive -> show-recent + first." + (cj/test--kill-test-term-buffers) + (let ((b1 (get-buffer-create "*test-term-mru-1*")) + (b2 (get-buffer-create "*test-term-mru-2*"))) + (unwind-protect + (cl-letf (((symbol-function 'cj/--term-toggle-displayed-window) + (lambda (&optional _frame) nil)) + ((symbol-function 'cj/--term-toggle-buffers) + (lambda () (list b1 b2)))) + (should (equal (cj/--term-toggle-dispatch) + (cons 'show-recent b1)))) + (kill-buffer b1) + (kill-buffer b2)))) + +(ert-deftest test-term-toggle--dispatch-no-window-no-buffer-returns-create-new () + "Boundary: nothing displayed, no alive terminals -> create-new." + (cj/test--kill-test-term-buffers) + (cl-letf (((symbol-function 'cj/--term-toggle-displayed-window) + (lambda (&optional _frame) nil)) + ((symbol-function 'cj/--term-toggle-buffers) + (lambda () nil))) + (should (equal (cj/--term-toggle-dispatch) '(create-new))))) + +(provide 'test-term-toggle--dispatch) +;;; test-term-toggle--dispatch.el ends here -- cgit v1.2.3