Fix middle-click yanking commands
* eat.el (eat-mouse-yank-primary): Switch to the window where the event was initiated. * eat.el (eat-mouse-yank-secondary): Switch to the window where the event was initiated. Ensure that the secondary selection is non-empty before sending it.
This commit is contained in:
parent
a1c4422f21
commit
f01afd6c24
1 changed files with 20 additions and 8 deletions
28
eat.el
28
eat.el
|
@ -5103,16 +5103,28 @@ STRING and ARG are passed to `yank-pop', which see."
|
||||||
(yank-from-kill-ring string arg)
|
(yank-from-kill-ring string arg)
|
||||||
(buffer-string))))))
|
(buffer-string))))))
|
||||||
|
|
||||||
(defun eat-mouse-yank-primary ()
|
(defun eat-mouse-yank-primary (&optional event)
|
||||||
"Send the primary selection to the terminal."
|
"Send the primary selection to the terminal.
|
||||||
(interactive)
|
|
||||||
|
EVENT is the mouse event."
|
||||||
|
(interactive "e")
|
||||||
|
(unless (windowp (posn-window (event-start event)))
|
||||||
|
(error "Position not in text area of window"))
|
||||||
|
(select-window (posn-window (event-start event)))
|
||||||
(eat-send-string-as-yank eat--terminal (gui-get-primary-selection)))
|
(eat-send-string-as-yank eat--terminal (gui-get-primary-selection)))
|
||||||
|
|
||||||
(defun eat-mouse-yank-secondary ()
|
(defun eat-mouse-yank-secondary (&optional event)
|
||||||
"Send the secondary selection to the terminal."
|
"Send the secondary selection to the terminal.
|
||||||
(interactive)
|
|
||||||
(eat-send-string-as-yank
|
EVENT is the mouse event."
|
||||||
eat--terminal (gui-get-selection 'SECONDARY)))
|
(interactive "e")
|
||||||
|
(unless (windowp (posn-window (event-start event)))
|
||||||
|
(error "Position not in text area of window"))
|
||||||
|
(select-window (posn-window (event-start event)))
|
||||||
|
(let ((secondary (gui-get-selection 'SECONDARY)))
|
||||||
|
(if secondary
|
||||||
|
(eat-send-string-as-yank eat--terminal secondary)
|
||||||
|
(error "No secondary selection"))))
|
||||||
|
|
||||||
(defun eat-xterm-paste (event)
|
(defun eat-xterm-paste (event)
|
||||||
"Handle paste operation EVENT from XTerm."
|
"Handle paste operation EVENT from XTerm."
|
||||||
|
|
Loading…
Add table
Reference in a new issue