[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vcursor.el: `vcursor-copy-word` and `vcursory-copy-line` not working as

From: Narendra Joshi
Subject: vcursor.el: `vcursor-copy-word` and `vcursory-copy-line` not working as expected
Date: Tue, 23 Nov 2021 20:30:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)


I think `vcursor.el` has a bug that causes `point` (the real cursor) to
move to where the virtual cursor is whenever `vcursor-copy-{word,line}`
are used. 

We need to wrap the `goto-char` call below in something like

--8<---------------cut here---------------start------------->8---
1 file changed, 3 insertions(+), 4 deletions(-)
lisp/vcursor.el | 7 +++----

modified   lisp/vcursor.el
@@ -785,12 +785,11 @@ vcursor-get-char-count
 This is called by most of the virtual-cursor copying commands to find
 out how much to copy."
   (with-current-buffer (overlay-buffer vcursor-overlay)
-    (let ((start (goto-char (overlay-start vcursor-overlay))))
-      (- (progn (apply func args) (point)) start)))
-  )
+    (save-excursion
+      (let ((start (goto-char (overlay-start vcursor-overlay))))
+        (- (progn (apply func args) (point)) start)))))
 ;; Make sure the virtual cursor is active.  Unless arg is non-nil,
 ;; report an error if it is not.
--8<---------------cut here---------------end--------------->8---

Best regards,
Narendra Joshi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]