evil icon indicating copy to clipboard operation
evil copied to clipboard

evil-define-motion on region causes region to be whole lines after some usage

Open Alan-Chen99 opened this issue 2 years ago • 0 comments

Issue type

  • Question

I have the following code in my config:

(evil-define-motion evil-visual-star-nomove (beg end)
    :jump nil
    :repeat nil
    :move-point nil
    (interactive "<r>")
    (save-excursion
        (let ((evil-search-wrap t) (inhibit-message t))
            (evil-visualstar/begin-search-forward beg end)
            (let ((evil-ex-search-direction 'backward))
                (evil-ex-search 1)))))

which would only be bound in visual state, with the intention that it will search the visual selection, and work in both visual and visual line state, and it should not move the cursor.

This used to work well, but at some point (I have been unable to pinpoint what caused this) it would start to select (and search) the whole line (go in visual line state). It does not happen when I start emacs, but it always happens after I used emacs for a while. I have unfortunately been unable to find a step to reproduce it.

I find that using evil-define-operator does not have this problem, but it would always move point to the beginning of the selection, despite me specifying :move-point to be nil

I know this isn't really a "motion" nor "operator"; what is the intended behavior here, and whats the intended way to accomplish this?

Environment

Emacs version: 29.0.60 Operating System: wsl, ubuntu 22.04 under windows 11 Evil version: 1.15.0 Evil installation type: straight (pulled from master) Graphical/Terminal: Graphical Tested in a make emacs session: No

Alan-Chen99 avatar Feb 09 '23 01:02 Alan-Chen99