Fix pasting into terminal-mode on term.el

* lisp/term.el (term--xterm-paste): Read pasted text from the
input event.  Suggested by Jared Finder <jared@finder.org>.
(Bug#49253)
This commit is contained in:
Eli Zaretskii 2023-12-16 14:44:32 +02:00
parent 5be94e2bce
commit c3331cb365

View file

@ -1392,8 +1392,13 @@ Entry to this mode runs the hooks on `term-mode-hook'."
(defun term--xterm-paste ()
"Insert the text pasted in an XTerm bracketed paste operation."
(interactive)
(term-send-raw-string (xterm--pasted-text)))
(interactive "e")
(unless (eq (car-safe event) 'xterm-paste)
(error "term--xterm-paste must be found to xterm-paste event"))
(let ((str (nth 1 event)))
(unless (stringp str)
(error "term--xterm-paste provided event does not contain paste text"))
(term-send-raw-string str)))
(declare-function xterm--pasted-text "term/xterm" ())