Show a hint cursor at the live position in copy/Emacs modes#255
Merged
Conversation
When the user navigates point off the live terminal cursor in copy or Emacs mode the buffer no longer indicates where new output will land — the only visible cursor follows point. Drop a thin overlay at the live cursor position that mimics `cursor-in-non-selected-windows' so the next-output spot stays visible while the user reads scrollback. Style follows the variable's full range: nil hides the hint, t derives from the saved `cursor-type' (box variants → hollow), hollow and box pass through to dedicated faces, bar / hbar fall back to hollow. Faces `ghostel-fake-cursor' (hollow) and `ghostel-fake-cursor-box' (solid) are user-customisable; the hollow face uses `:line-width (-1 . -1)' so the box stays inside the character cell and does not reflow the line. Gated by the new `ghostel-readonly-fake-cursor' defcustom (default t). Updates are driven by `pre-redisplay-functions' installed buffer-locally on read-only entry — fires only when the display actually needs refreshing, no `post-command-hook' overhead, and catches both point movement and the live cursor advancing under streaming Emacs-mode output through one mechanism. The existing internal helper `ghostel--line-mode-cursor-buffer-pos' was renamed to `ghostel--cursor-buffer-pos' to reflect that it is no longer line-mode-specific. Tests cover style resolution (incl. bar/hbar fallback), overlay create/clear when point coincides with or moves away from the live cursor, both defcustom and `cursor-in-non-selected-windows' kill switches, the non-readonly modes never installing the overlay, the box face path, the EOL after-string fallback, and the `pre-redisplay-functions' lifecycle on leave-readonly.
8899ab4 to
6bffc2b
Compare
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.
Summary
cursor-in-non-selected-windows: nil hides; t derives from the savedcursor-type(box variants → hollow); hollow / box pass through to dedicated faces; bar / hbar fall back to hollow. Two new customisable faces (ghostel-fake-cursor,ghostel-fake-cursor-box); gated byghostel-readonly-fake-cursor(default t).pre-redisplay-functionsinstalled buffer-locally on read-only entry — nopost-command-hookoverhead, fires only when redisplay is happening, and a single mechanism handles both point movement and the live cursor advancing under streaming Emacs-mode output.ghostel--line-mode-cursor-buffer-pos→ghostel--cursor-buffer-pos(no longer line-mode-specific). Single in-tree caller updated.Test plan
make -j4 all(340 elisp+native tests, lint, build, Zig)make test-evil(78/78)M-x ghostel-emacs-mode, navigate point up into scrollback — the hint should appear at the prompt positionsleep 5 && ls &) — hint should track the new cursor row in Emacs modeM-x ghostel-copy-mode— hint stays put (terminal frozen)setq cursor-in-non-selected-windows nilwhile in copy mode — next redisplay clears the overlay'box,'hollow,'barto confirm style resolution