Repository navigation
Stop evil-ghostel insert entry at the input start - #789
Merged
Merged
Conversation
evil-ghostel-goto-input-position clamped a same-row target at the input end only. With point inside the prompt on the cursor's row, e.g. after 0, i and a sent left arrows the shell ignores at its start of line and then moved point to the target, so the caret stayed inside the prompt until the next keystroke redrew it. The arrows went out twice, from the command and from the insert-state entry hook, and bash rang the bell for each one. Clamp a leftward same-row target to the input start after a detected prompt. A regexp-fallback match that ends past the cursor is ignored, so a prompt-less row keeps its unclamped moves. The elate shell matrix gains 0 i and 0 a groups, and the python3 one 0 i for the regexp-detected prompt. Closes #788.
ghostel--regex-prompt-end matched ghostel-prompt-regexp on any row without ghostel-prompt text, including the rows a long input line soft-wraps onto. Text up to a $, #, % or > on such a row was taken for a prompt, so C-a in copy and Emacs mode and evil-ghostel's ^, I and operators stopped after it. With the leftward clamp in evil-ghostel-goto-input-position, i, a and paste stopped there too. Return nil when the row begins after a ghostel-wrap newline: a wrapped row never starts with a prompt. Rows after a hard newline still use the regexp, which is what detects continuation prompts. The elate matrices gain a wrapped-row group each: 0 i wrap in the shell matrix and wrap-C-a in the plain read-only suite.
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.
Summary
With
evil-ghostel-modein semi-char mode,iorapressed with point inside the prompt on the cursor's row left the caret in the prompt until the next keystroke. Closes #788.evil-ghostel-goto-input-positionclamped a same-row target on the right only:evil-ghostel-goto-input-position (pos) if pos is on the cursor's row if pos is right of the cursor pos = min(pos, input end) # never walk into an autosuggestion + else if a prompt is detected on the row, ending at or before the cursor + pos = max(pos, input start) # the shell cannot move into the prompt send arrow keys for the distance, then move point to posOne place covers
i,a, the insert-state entry hook and paste. The ignored left arrows are no longer sent, so bash stops ringing the bell.The clamp exposed a weakness in the prompt regexp fallback, fixed in the second commit:
Rows after a hard newline still use the regexp, which is what detects continuation prompts such as
>. This also correctsC-ain copy and Emacs mode and evil-ghostel's^,Iand operators on wrapped rows.Evidence
0theniat the prompt: point stays inside the prompt, still there after one idle second. Oneiat an empty prompt sends 46 left arrows in bash and rings 46 bells.After: point lands on the input start and no arrow is sent.
aaa… $HOME bar,0 ion that row with the clamp alone: column 19, after the$.After: column 0, and the typed character lands there.
0 i,0 a,0 i wrapinshells.json(bash, zsh, fish, nu),0 iinpython3.json,wrap-C-ainreadonly-ghostel.json. The two wrap groups fail with the old helper swapped in. All 17 matrix runs exit 0 with only the documented expected failures.make -j8 allexits 0, 1516 tests, 0 unexpected.Merge Danger
Door: two-way
Two small elisp changes, no data or protocol change; reverting the commits restores the old behaviour.
Blast Radius: cursor placement
$,#,%or>while the typed text does; operators,Iand^already behaved that way on those rows.ghostel--regex-prompt-endis shared byghostel-input-start-point,ghostel-beginning-of-input-or-lineand consult-ghostel; it now returns nil on wrapped rows for all of them.