mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-29 19:48:19 +00:00
Escape NUL bytes in X selections (Bug#6991)
* lisp/term/w32-win.el (w32--set-selection): * lisp/select.el (xselect--encode-string): Replace NUL bytes with "\0". * doc/emacs/killing.texi: Document new behavior. * etc/NEWS (times): Announce it.
This commit is contained in:
parent
0ae28c71c7
commit
c87c87fcc3
@ -519,6 +519,10 @@ when exiting Emacs; if you wish to prevent Emacs from transferring
|
||||
data to the clipboard manager, change the variable
|
||||
@code{x-select-enable-clipboard-manager} to @code{nil}.
|
||||
|
||||
Since strings containing NUL bytes are usually truncated when passed
|
||||
through the clipboard, Emacs replaces such characters with ``\0''
|
||||
before transfering them to the system's clipboard.
|
||||
|
||||
@vindex select-enable-primary
|
||||
@findex clipboard-kill-region
|
||||
@findex clipboard-kill-ring-save
|
||||
|
4
etc/NEWS
4
etc/NEWS
@ -325,6 +325,10 @@ debug.el and edebug.el have been updated to heed to this variable.
|
||||
The old behaviour of using 'prin1' can be restored by customizing the
|
||||
new option 'debugger-print-function'.
|
||||
|
||||
+++
|
||||
** NUL bytes in strings copied to the system clipboard are now
|
||||
replaced with "\0".
|
||||
|
||||
+++
|
||||
** The new variable 'x-ctrl-keysym' has been added to the existing
|
||||
roster of X keysyms. It can be used in combination with another
|
||||
|
@ -475,6 +475,9 @@ two markers or an overlay. Otherwise, it is nil."
|
||||
(t
|
||||
(error "Unknown selection type: %S" type)))))
|
||||
|
||||
;; Most programs are unable to handle NUL bytes in strings.
|
||||
(setq str (replace-regexp-in-string "\0" "\\0" str t t))
|
||||
|
||||
(setq next-selection-coding-system nil)
|
||||
(cons type str))))
|
||||
|
||||
|
@ -396,7 +396,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
|
||||
;;; Fix interface to (X-specific) mouse.el
|
||||
(defun w32--set-selection (type value)
|
||||
(if (eq type 'CLIPBOARD)
|
||||
(w32-set-clipboard-data value)
|
||||
(w32-set-clipboard-data (replace-regexp-in-string "\0" "\\0" value t t))
|
||||
(put 'x-selections (or type 'PRIMARY) value)))
|
||||
|
||||
(defun w32--get-selection (&optional type data-type)
|
||||
|
Loading…
Reference in New Issue
Block a user