Make evil-ghostel-goto-cursor a linewise motion#486
Merged
Conversation
In line-visual state (VG) point stayed on the original line instead of extending the selection to the terminal cursor. As a plain command, evil-ghostel-goto-cursor lacked :keep-visual, so evil expanded the line-visual region to whole lines before the command and contracted it after, reverting the jump. Char-visual (vG) was unaffected because its expand/contract is point-neutral. Define it with evil-define-motion (:type line, :jump t), mirroring evil-goto-line: that supplies :keep-visual t and suppresses the expand/contract. The inactive branch now passes COUNT through to evil-goto-line. Add regression tests for VG/vG driven through evil's visual command-loop hooks, since execute-kbd-macro does not dispatch commands under --batch. Fix #485
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
In an evil-ghostel buffer,
Gin line-visual state (VG) left point on theoriginal line instead of extending the selection to the terminal cursor.
Char-visual (
vG) worked.Root cause
evil-ghostel-goto-cursorwas a plaindefun, so it lacked evil's:keep-visualproperty. In line-visual,evil-visual-pre-commandthereforeexpanded the region to whole lines (moving point to a line boundary) before the
command ran, and
evil-visual-post-commandcontracted it afterward — revertingthe jump. Char-visual's expand/contract is point-neutral, so it was unaffected.
Fix
Define
evil-ghostel-goto-cursorwithevil-define-motion(:type line,:jump t), mirroringevil-goto-line.evil-define-motionsupplies:keep-visual t, which suppresses the line-visual expand/contract so the jumpedpoint sticks. The inactive branch now passes
COUNTthrough toevil-goto-line.Testing
make -j8 all— green (build, lint, all suites; evil-ghostel 112/112).VGandvG, plus the inactiveevil-goto-linefallback. They drive
Gthrough evil's visual command-loop hooks(
evil-visual-pre-command/-post-command) becauseexecute-kbd-macrodoes not dispatch commands under
--batch. Verified the line-visual testfails on the pre-fix code and passes after.
VGnow moves point to thecursor row and selects line 1 → cursor row;
vGstill works.Closes #485