summaryrefslogtreecommitdiff
path: root/lisp/term.el
diff options
context:
space:
mode:
authorPhil Sainty <psainty@orcon.net.nz>2023-03-27 01:06:52 +1300
committerPhil Sainty <psainty@orcon.net.nz>2023-03-27 01:17:22 +1300
commita952bdd6af081ef78f25f20d0a6cde612ce10df0 (patch)
treecf2fe575464f96829f78890da59f93fbc3072521 /lisp/term.el
parentb08bf8286059cb75166401c8cad01e3661cb8833 (diff)
downloademacs-a952bdd6af081ef78f25f20d0a6cde612ce10df0.tar.gz
emacs-a952bdd6af081ef78f25f20d0a6cde612ce10df0.tar.bz2
emacs-a952bdd6af081ef78f25f20d0a6cde612ce10df0.zip
Fix primary selection modification during `term-mouse-paste' (bug#58608)
* lisp/term.el (term-mouse-paste): Prevent the primary selection from being changed in the process of sending it to the inferior process.
Diffstat (limited to 'lisp/term.el')
-rw-r--r--lisp/term.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/term.el b/lisp/term.el
index 3e4907e8bfc..2e719567058 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -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."