]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix primary selection modification during `term-mouse-paste' (bug#58608)
authorPhil Sainty <psainty@orcon.net.nz>
Sun, 26 Mar 2023 12:06:52 +0000 (01:06 +1300)
committerPhil Sainty <psainty@orcon.net.nz>
Sun, 26 Mar 2023 12:18:37 +0000 (01:18 +1300)
* lisp/term.el (term-mouse-paste): Prevent the primary selection from
being changed in the process of sending it to the inferior process.

lisp/term.el

index 3e4907e8bfc84ff1a1ad27cc6477a6f778af4033..2e71956705829cc8030aaba926ac611a2cd8bf11 100644 (file)
@@ -1372,7 +1372,13 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (run-hooks 'mouse-leave-buffer-hook)
   (setq this-command 'yank)
   (mouse-set-point click)
-  (term-send-raw-string (gui-get-primary-selection)))
+  ;; As we have moved point, bind `select-active-regions' to prevent
+  ;; the `deactivate-mark' call in `term-send-raw-string' from
+  ;; changing the primary selection (resulting in consecutive calls to
+  ;; `term-mouse-paste' each sending different text). (bug#58608).
+  ;; FIXME: Why does this command change point at all?
+  (let ((select-active-regions nil))
+    (term-send-raw-string (gui-get-primary-selection))))
 
 (defun term-paste ()
   "Insert the last stretch of killed text at point."