Repository navigation
Let evil-ghostel move left when typed text is marked as prompt - #794
Merged
Merged
Conversation
fish before 4.3 sends OSC 133 A without B, so the terminal keeps marking typed text as prompt and ghostel--cursor-row-input-start returns the cursor on every row with typed text. evil-ghostel-goto-input-position and the insert-state entry clamped a leftward target to that position: i, a and x left of the cursor acted at the cursor instead. Take the limit from evil-ghostel--cursor-left-limit, which counts a prompt ending at the cursor only when ghostel-prompt-regexp ends there too. On an empty input whose prompt the regexp does not match to its end, i and a from inside the prompt send their left arrows again. The insert-state entry also ignores a regexp match that ends past the cursor, as evil-ghostel-goto-input-position does.
dakra
force-pushed
the
fix/evil-ghostel-unmarked-input-clamp
branch
from
November 6, 2026 21:11
695d2eb to
5048d0f
Compare
This branch was previously deployed
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
0557ea77clamps a leftward same-row target inevil-ghostel-goto-input-positiontoghostel--cursor-row-input-start. That is only valid where the shell marks its input start.fish before 4.3 sends OSC 133 A without B. The terminal then keeps marking typed text as prompt, the
ghostel-promptrun ends at the cursor on every row with typed text, and the "input start" is the cursor itself. Every leftward move was clamped away: withecho abcdtyped,ESC h i Xgaveecho abcdXinstead ofecho abXcd, andh h xdeleted the wrong character. The insert-state entry from copy mode had the same clamp.The clamp is not in a release yet (it landed after 0.61.0).
Fix
evil-ghostel--cursor-left-limitreplaces the direct calls at both sites. A prompt that ends exactly at the cursor counts as the input start only whenghostel-prompt-regexpends there too:> |): the regexp ends at the cursor, the clamp applies, evil-ghostel: i on the current prompt row can enter insert before the input boundary #788 stays fixed> echo hello|): the regexp ends after>, nothing is clampedNo state and no core change. The insert-state entry also gains the "regexp match ends past the cursor" guard the command already had.
Known limitation
On an empty input, the #788 clamp now needs the regexp to match the prompt to its end. Where it does not,
0 ibehaves as in 0.61.0 again (left arrows the shell ignores, caret in the prompt until the next keystroke). Examples:robbyrussell:➜ ghostel git:(main) ✗ghostel-prompt-regexpset to nilWith typed input the clamp is unaffected on shells that send B. An empty OSC 133 prompt and prompt-marked typed text look identical in the buffer, so closing this gap needs to know whether B arrived since the last A (a flag set in
ghostel--osc133-marker, or a native query of the cursor's semantic state).Testing
make -j8 test test-native test-evil test-consult lint: 1518 tests, 0 unexpected, lint clean.test-zigand the module build were not run locally (Homebrew has Zig 0.17.1,build.zigrequires 0.17.0); the change is elisp only and the tests ran against a module built from the same Zig sources.main), and the empty OSC 133 prompt clamp.--features no-mark-prompt(A without B): a leftward-move scenario (h i,h h x,h h a,b d w,b c w) goes from 3 failures onmainto 0.shells.jsongoes from 19 failing groups to 16;0 i,0 aand0 i wrappass again, no group fails only with the change. The remaining 16 need^/Ito find the input start on such a shell and fail before0557ea77too.shells.jsonon bash, zsh, fish 4.9 and nu,python3.json,readonly-evil-ghostel.json(including the empty-promptclampgroup),tracking-ghostel.jsonand the fourboundary-*suites all pass apart from the documented xfails.