evil-easymotion icon indicating copy to clipboard operation
evil-easymotion copied to clipboard

bug: avy teleport functionality broken for evilem-motion-next/previous-line

Open betaprior opened this issue 5 years ago • 3 comments

I am observing that when I invoke evilem-motion-next-line and attempt to teleport the target line (via t <target-combo>), only the first word on the line gets teleported (it should be the whole line). Same for -previous-line.

This behavior works as expected with avy-goto-line.

This would be great to fix as these motions are more usable compared to avy-goto-line.

betaprior avatar Jun 25 '20 22:06 betaprior

I'm sorry I can't really understand. What is teleporting a line, as opposed to a word in that line?

PythonNut avatar Jul 21 '20 00:07 PythonNut

See gif for illustration. I am invoking the teleport action (i.e. pressing "t" before the avy hotkey). The behavior is expected to be the same in both cases, namely, line two should teleport to the top.

Peek 2020-07-20 18-59

betaprior avatar Jul 21 '20 01:07 betaprior

Oh I see, this is a feature I wasn't aware of. Unfortunately, the design of avy makes fixing this a bit difficult. E.g.

(defun avy-forward-item ()
  (if (eq avy-command 'avy-goto-line)
      (end-of-line)
    (forward-sexp))
  (point))

(Note the hardcoded condition).

There are a lot of ways we could approach this:

  1. Bind the action functions (i.e. define our own line-wise and bind them for line-wise motions)
  2. Bind avy-dispatch-alist
  3. Define a new avy handler (seems like a lot of work)

Note that for some reason, simply binding avy-command doesn't work. I don't know why but honestly, that seems like a bad approach anyway given how avy is structured.

PythonNut avatar Jul 24 '20 19:07 PythonNut