Function: ghostel-mouse-paste-primary-or-release
ghostel-mouse-paste-primary-or-release is an interactive and natively
compiled function defined in ghostel.el.
Signature
(ghostel-mouse-paste-primary-or-release EVENT)
Documentation
Forward EVENT to the terminal, or paste the primary selection.
Selects the click's window first so a middle-click into an
unfocused ghostel window pastes into that terminal, not whichever
buffer happened to be current. When terminal mouse input consumes
the event, behaves like ghostel--mouse-release. Otherwise pastes
the X primary selection at the live cursor via ghostel--paste-text,
which uses bracketed paste when the terminal has DEC 2004 enabled.
When in copy or Emacs mode and ghostel-readonly-fast-exit is
non-nil, exits to the prior input mode first so the paste lands at
the prompt.
Key Bindings
ghostel-mode-map <mouse-2>
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-mouse-paste-primary-or-release (event)
"Forward EVENT to the terminal, or paste the primary selection.
Selects the click's window first so a middle-click into an
unfocused ghostel window pastes into that terminal, not whichever
buffer happened to be current. When terminal mouse input consumes
the event, behaves like `ghostel--mouse-release'. Otherwise pastes
the X primary selection at the live cursor via `ghostel--paste-text',
which uses bracketed paste when the terminal has DEC 2004 enabled.
When in copy or Emacs mode and `ghostel-readonly-fast-exit' is
non-nil, exits to the prior input mode first so the paste lands at
the prompt."
(interactive "e")
(select-window (posn-window (event-start event)))
(unless (ghostel--mouse-release event)
(let ((text (gui-get-primary-selection)))
(when (and text (not (string-empty-p text)))
(ghostel--on-user-input)
(ghostel--paste-text text)))))