From c3331cb3659ffca0b04e0b789e9826b53777a70a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Dec 2023 14:44:32 +0200 Subject: [PATCH] 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 . (Bug#49253) --- lisp/term.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/term.el b/lisp/term.el index 68b1136a0b4..b9f739dc8f1 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -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" ()) -- 2.39.2