Function: xterm--pasted-text

xterm--pasted-text is a byte-compiled function defined in xterm.el.gz.

Signature

(xterm--pasted-text)

Documentation

Handle the rest of a terminal paste operation.

Return the pasted text as a string.

Source Code

;; Defined in /usr/src/emacs/lisp/term/xterm.el.gz
(defun xterm--pasted-text ()
  "Handle the rest of a terminal paste operation.
Return the pasted text as a string."
  (let ((end-marker-length (length xterm-paste-ending-sequence)))
    (with-temp-buffer
      (set-buffer-multibyte nil)
      (while (not (search-backward xterm-paste-ending-sequence
                                   (- (point) end-marker-length) t))
	(let ((event (read-event nil nil
                                 ;; Use finite timeout to avoid glomming the
                                 ;; event onto this-command-keys.
                                 most-positive-fixnum)))
	  (when (eql event ?\r)
	    (setf event ?\n))
	  (insert event)))
      (let ((last-coding-system-used))
	(decode-coding-region (point-min) (point) (keyboard-coding-system)
                              t)))))