aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-10 12:23:14 -0500
committerCraig Jennings <c@cjennings.net>2026-05-10 12:23:14 -0500
commitc56a638192f3b6aff13c26e34ce78db0d26de6fc (patch)
tree2b4405995125ad3da06d5c1d74b3a29062c20f56
parenta7cc492131361195ad08d433c64c7c76b255bc8c (diff)
downloaddotemacs-c56a638192f3b6aff13c26e34ce78db0d26de6fc.tar.gz
dotemacs-c56a638192f3b6aff13c26e34ce78db0d26de6fc.zip
fix(vterm): use a block cursor in vterm-copy-mode
The 3-pixel bar was visible but a block matches the rest of my Emacs cursor and lets the standard cursor color and `blink-cursor-mode' behavior carry through unchanged. Same enter/exit semantics: forced visible on entry, buffer-local override killed on exit so the live terminal goes back to the TUI's chosen state. Update the test expectations and rename the "prior-was-box" boundary test to "prior-was-hbar" so it still proves the override does something (the prior and the override would otherwise both be `box').
-rw-r--r--modules/vterm-config.el8
-rw-r--r--tests/test-vterm-copy-mode-cursor.el22
2 files changed, 15 insertions, 15 deletions
diff --git a/modules/vterm-config.el b/modules/vterm-config.el
index eb472c57..93a91915 100644
--- a/modules/vterm-config.el
+++ b/modules/vterm-config.el
@@ -388,12 +388,12 @@ The vterm C module sets `cursor-type' to nil whenever the underlying
TUI sends DECTCEM (`\\e[?25l') to hide the terminal cursor — typical
for full-screen TUIs like Claude Code. In `vterm-copy-mode' the user
is navigating the buffer, not watching the TUI, so the cursor must
-be visible. Switches to a 3-pixel bar (drawn between characters
-rather than inverting one) so face-heavy TUI output doesn't hide it
-either. On exit, kills the buffer-local override so vterm's normal
+be visible. Switches to a `box' so the cursor color and blinking
+behavior follow Emacs's normal cursor-face / `blink-cursor-mode'
+defaults. On exit, kills the buffer-local override so vterm's normal
cursor-visibility tracking resumes."
(if vterm-copy-mode
- (setq-local cursor-type '(bar . 3))
+ (setq-local cursor-type 'box)
(kill-local-variable 'cursor-type)))
(add-hook 'vterm-copy-mode-hook #'cj/--vterm-copy-mode-restore-cursor)
diff --git a/tests/test-vterm-copy-mode-cursor.el b/tests/test-vterm-copy-mode-cursor.el
index 85fc2897..49625405 100644
--- a/tests/test-vterm-copy-mode-cursor.el
+++ b/tests/test-vterm-copy-mode-cursor.el
@@ -39,20 +39,20 @@ Stubs `vterm--enter-copy-mode' and `vterm--exit-copy-mode' so toggling
(setq-local cursor-type nil)
(let ((vterm-copy-mode t))
(cj/--vterm-copy-mode-restore-cursor))
- (should (equal cursor-type '(bar . 3)))))
+ (should (equal cursor-type 'box))))
-(ert-deftest test-vterm-copy-mode-cursor-restored-when-prior-was-box ()
- "Boundary: entering copy-mode overrides any prior cursor-type with the bar."
+(ert-deftest test-vterm-copy-mode-cursor-restored-when-prior-was-hbar ()
+ "Boundary: entering copy-mode overrides any prior cursor-type with the block."
(with-temp-buffer
- (setq-local cursor-type 'box)
+ (setq-local cursor-type 'hbar)
(let ((vterm-copy-mode t))
(cj/--vterm-copy-mode-restore-cursor))
- (should (equal cursor-type '(bar . 3)))))
+ (should (equal cursor-type 'box))))
(ert-deftest test-vterm-copy-mode-cursor-override-killed-on-exit ()
"Normal: exiting copy-mode kills the buffer-local cursor-type override."
(with-temp-buffer
- (setq-local cursor-type '(bar . 3))
+ (setq-local cursor-type 'box)
(should (local-variable-p 'cursor-type))
(let ((vterm-copy-mode nil))
(cj/--vterm-copy-mode-restore-cursor))
@@ -74,7 +74,7 @@ restore function -- not just the helper in isolation."
;; let-binding the variable. This fires `vterm-copy-mode-hook'.
(vterm-copy-mode 1)
(should (eq vterm-copy-mode t))
- (should (equal cursor-type '(bar . 3)))
+ (should (equal cursor-type 'box))
;; Exit through the same path.
(vterm-copy-mode -1)
(should (eq vterm-copy-mode nil))
@@ -88,7 +88,7 @@ most often -- copy and exit in one keystroke."
(setq-local cursor-type nil)
(vterm-copy-mode 1)
(should (eq vterm-copy-mode t))
- (should (equal cursor-type '(bar . 3)))
+ (should (equal cursor-type 'box))
(insert "selectable text on this line")
(set-mark (point-min))
(goto-char (point-max))
@@ -103,7 +103,7 @@ selected -- the cancel path skips the kill-ring step entirely."
(test-vterm-copy-mode-cursor--in-fake-vterm-buffer
(setq-local cursor-type nil)
(vterm-copy-mode 1)
- (should (equal cursor-type '(bar . 3)))
+ (should (equal cursor-type 'box))
(cj/vterm-copy-mode-cancel)
(should (eq vterm-copy-mode nil))
(should-not (local-variable-p 'cursor-type))))
@@ -122,7 +122,7 @@ still run; cursor restoration must still happen."
(insert "line content")
(setq-local cursor-type nil)
(vterm-copy-mode 1)
- (should (equal cursor-type '(bar . 3)))
+ (should (equal cursor-type 'box))
(deactivate-mark)
(should-not (use-region-p))
(vterm-copy-mode-done nil)
@@ -136,7 +136,7 @@ state. The cursor goes back and forth cleanly."
(setq-local cursor-type nil)
(dotimes (_ 3)
(vterm-copy-mode 1)
- (should (equal cursor-type '(bar . 3)))
+ (should (equal cursor-type 'box))
(vterm-copy-mode -1)
(should-not (local-variable-p 'cursor-type)))))