Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: evilem motion forward word end stopping at single letters #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kassick
Copy link

@kassick kassick commented Jan 19, 2022

Couple of fixes:

call evilem--compute-inclusivity with the name of the function: fixes several evilem motions not respecting the inclusive/exclusive rules of the evil movement

During the macro expantion of

(evilem-make-motion evilem-motion-some #'evil-some-motion)

the function quote argument becomes (funcion . (evil-some-motion . nil))

This list was being passed to evilem--compute-inclusivity , which would try to
take the first element and try to fetch the :type property of the evil function effectivelyevil-get-command-propertywith the symbol'functioninstead of'evil-some-motion`.

This MR fixes the erroneous, keeping backwards compatibility in case
someone anywhere called (evilem--compute-inclusivity '(evil-some-motion))

make {word,WORD}-end movements see past single letters in operator-state

evilem-motion-forward-{word, WORD}-end does not collect all targets when called
in operator-state due to a corner case in evil-forward-word-end: when
called in operator-state, evil ensures the cursor does not move if it's over
a one-letter word.

As a result, evilem--collect's repeated calls to forward-word-end in operator
state will stop at the first single-letter word inside the line.

For example, g s e will place targets on every word as expected:

   cursor
     |
     v
     this is a word
        ^  ^ ^    ^
        |  | |    |
        a  s d    f

But when calling evilem-motion-forward-word-end during yank/delete/change, no
targets will be created after "a", as evilem--collect stops after
evil-forward-word-end refused to move the cursor in "a". For example, pressing y g s e in
the example below will not place any target at "word" or any text afterwards:

   cursor
     |
     v
     this is a word
        ^  ^ ^
        |  | |
        a  s d

This MR fixes this behavior by temporarily setting evil-state to 'motion
while collecting targets.

…or-state

evilem-motion-forward-{word, WORD}-end does not collect all targets when called
in operator-state due to a corner case in evil-forward-word-end: when
called in operator-state, evil ensures the cursor does not move if it's over
a one-letter word.

As a result, evilem--collect repeated calls to forward-word-end in operator
state will stop at the first single-letter word inside the line.

For example, `g s e` will place targets on every word as expected:

       cursor
         |
         v
         this is a word
            ^  ^ ^    ^
            |  | |    |
            a  s d    f

But when calling evilem-motion-forward-word-end during yank/delete/change, no
targets will be created after "a", as evilem--collect stops after
evil-forward-word-end did not move the cursor in "a". For example, pressiong `y g s e` in
the example below will not place any target at "word" or any text afterwards:

       cursor
         |
         v
         this is a word
            ^  ^ ^
            |  | |
            a  s d

This commit fixes this behaviour by temporarely setting evil-state to 'motion
while collecting targets.
During the macro expantion of

    (evilem-make-motion evilem-motion-some #'evil-some-motion)

the function quote argument becomes (funcion . (evil-some-motion . nil))

This list was being passed to evilem--compute-inclusivity , which would try to
take the first element and try to fetch the :type property of the evil function
effectively evil-get-command-property with the symbol 'function instead of
'evil-some-motion.

This commit fixes this behaviour, keeping backwards compatibility in case
someone anywhere called (evilem--compute-inclusivity '(evil-some-motion))
kassick added a commit to kassick/dotfiles that referenced this pull request Jan 19, 2022
kassick added a commit to kassick/dotfiles that referenced this pull request Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant