[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buf
From: |
Phil Sainty |
Subject: |
bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers |
Date: |
Wed, 19 Oct 2022 16:22:32 +1300 |
User-agent: |
Orcon Webmail |
In line mode middle click calls `mouse-yank-primary'
I realised I should look at this as well, and sure enough it has
some handling for `select-active-regions':
(defun mouse-yank-primary (click)
"Insert the primary selection at the position clicked on.
Move point to the end of the inserted text, and set mark at
beginning. If `mouse-yank-at-point' is non-nil, insert at point
regardless of where you click."
(interactive "e")
;; Give temporary modes such as isearch a chance to turn off.
(run-hooks 'mouse-leave-buffer-hook)
;; Without this, confusing things happen upon e.g. inserting into
;; the middle of an active region.
(when select-active-regions
(let (select-active-regions)
(deactivate-mark)))
(or mouse-yank-at-point (mouse-set-point click))
(let ((primary (gui-get-primary-selection)))
(push-mark)
(insert-for-yank primary)))
The call to (mouse-set-point click) is also conditional here:
(or mouse-yank-at-point (mouse-set-point click))
As opposed to:
(defun term-mouse-paste (click)
"Insert the primary selection at the position clicked on."
(interactive "e")
;; Give temporary modes such as isearch a chance to turn off.
(run-hooks 'mouse-leave-buffer-hook)
(setq this-command 'yank)
(mouse-set-point click)
(term-send-raw-string (gui-get-primary-selection)))
I don't know if `mouse-yank-at-point' needs consideration here too?
I wondered whether both of these could be rewritten to use a common
subroutine, but it might be a bit awkward. Failing that, I would
cross-reference them in code comments (are there any other similar
functions besides?).