1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Prevent selection converter from signalling if buffer is narrowed

* lisp/select.el (xselect-convert-to-string): If positions are
outside the accessible portion of the buffer, don't return
anything.
This commit is contained in:
Po Lu 2022-08-13 17:49:31 +08:00
parent 6de88b6b02
commit f937a0f3f8

View file

@ -673,9 +673,12 @@ two markers or an overlay. Otherwise, it is nil."
(let ((str (cond ((stringp value) value)
((setq value (xselect--selection-bounds value))
(with-current-buffer (nth 2 value)
(buffer-substring (nth 0 value)
(nth 1 value)))))))
(xselect--encode-string type str t)))
(when (and (>= (nth 0 value) (point-min))
(<= (nth 1 value) (point-max)))
(buffer-substring (nth 0 value)
(nth 1 value))))))))
(when str
(xselect--encode-string type str t))))
(defun xselect-convert-to-length (_selection _type value)
(let ((len (cond ((stringp value)