evil-ghostel: follow terminal cursor in emacs-state#135
Merged
dakra merged 1 commit intodakra:mainfrom Apr 18, 2026
Merged
Conversation
36f9d34 to
a67cf2b
Compare
emacs-state is evil's vanilla-Emacs escape hatch; users expect it to behave like a normal terminal, which means point should track the terminal cursor just like in insert-state. Extend the around-redraw freeze-exclusion and the state-entry sync hook to cover both states.
a67cf2b to
f05e0db
Compare
Owner
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
evil-ghostel--around-redrawfreezes point in every evil state exceptinsert, so enteringemacs-state(the vanilla-Emacs escape hatch,typically reached via
C-z) leaves the cursor stuck wherever it waswhen the state changed while the TUI keeps redrawing elsewhere. The
TUI's own rendered cursor (e.g. Claude Code's white prompt block)
moves, but Emacs's point doesn't, so cursor-sensitive operations and
on-screen feedback go out of sync.
Insert-state is the "follow cursor" state today — and emacs-state has
the same expectation from the user's perspective: it means "turn evil
off and behave like vanilla", which in a terminal context should mean
"follow the terminal cursor".
Reproduction
In any ghostel buffer with
evil-ghostel-modeactive, pressC-zto enter emacs-state. The Emacs cursor stays frozen while the
terminal keeps updating; moving the point manually is the only way
to "unstick" it. Switching back to insert-state re-enables the sync.
Fix
evil-ghostel--around-redrawfreeze-exclusion from(not (eq evil-state 'insert))to(not (memq evil-state '(insert emacs)))so redraws move point tothe terminal cursor in both states.
evil-ghostel--insert-state-entrytoevil-emacs-state-entry-hookso switching into emacs-state syncs point immediately, matching the
behaviour already in place for insert-state.
Includes a regression test
(
evil-ghostel-test-redraw-moves-point-emacs-state) that entersemacs-state, moves point away from the terminal cursor, forces a
redraw, and asserts point snaps back to the cursor column. Verified
to fail against
upstream/mainand pass on this branch.