lispyville icon indicating copy to clipboard operation
lispyville copied to clipboard

"atom-end" motions are offset to the right

Open yuhan0 opened this issue 5 years ago • 4 comments

;;    Aa  B  Cc
(peanut butter sandwich)

With the cursor on A and the atom-movement theme enabled, pressing "E" and "gE" should bring the cursor to C and A respectively, but it ends up being offset one character to the right (c and a). Also the backward-atom-end function is missing a let-block for orig-pos variable.

It might not be the most elegant solution, but I fixed the behaviour by simply adding (forward-char -1) at the end of the functions and :type inclusive to keep dE, cE working as expected.

 (evil-define-motion lispyville-forward-atom-end (count)
   "Go to the next atom or comment end COUNT times."
+  :type inclusive
   (or count (setq count 1))
+  (forward-char 1)
   (if (< count 0))
...
-          (cl-return))))))
+          (cl-return))))
+    (forward-char -1)))

If this is alright (still haven't figured out how to run the tests properly) I could submit a simple PR :) Thanks!

yuhan0 avatar Oct 28 '18 08:10 yuhan0