[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/pgtk 565995d: Fix unicode strings can't be pasted correctly
From: |
Yuuki Harano |
Subject: |
feature/pgtk 565995d: Fix unicode strings can't be pasted correctly |
Date: |
Tue, 2 Mar 2021 08:45:12 -0500 (EST) |
branch: feature/pgtk
commit 565995d408ca65ec9f981f175cca29d2164a5fd0
Author: Yuuki Harano <masm+github@masm11.me>
Commit: Yuuki Harano <masm+github@masm11.me>
Fix unicode strings can't be pasted correctly
* lisp/select.el (x-select-request-type): Use text/plain;charset=utf-8
instead.
(gui--selection-value-internal): same.
(gui-get-selection): Treat text/plain;charset=utf-8 as utf-8.
* src/pgtkselect.c (Fpgtk_get_selection_internal): Support
text/plain;charset=utf-8 as foreign-selection.
(syms_of_pgtkselect): Add new symbol.
---
lisp/select.el | 12 +++++++-----
src/pgtkselect.c | 3 +++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/lisp/select.el b/lisp/select.el
index 5e8a364..72f03e7 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -140,26 +140,27 @@ MS-Windows does not have a \"primary\" selection."
(defcustom x-select-request-type nil
"Data type request for X selection.
The value is one of the following data types, a list of them, or nil:
- `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT', `text/plain'
+ `COMPOUND_TEXT', `UTF8_STRING', `STRING', `TEXT',
`text/plain\\;charset=utf-8'
If the value is one of the above symbols, try only the specified type.
If the value is a list of them, try each of them in the specified
order until succeed.
-The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING
text/plain)."
+The value nil is the same as the list (UTF8_STRING COMPOUND_TEXT STRING
+text/plain\\;charset=utf-8)."
:type '(choice (const :tag "Default" nil)
(const COMPOUND_TEXT)
(const UTF8_STRING)
(const STRING)
(const TEXT)
- (const text/plain)
+ (const text/plain\;charset=utf-8)
(set :tag "List of values"
(const COMPOUND_TEXT)
(const UTF8_STRING)
(const STRING)
(const TEXT)
- (const text/plain)))
+ (const text/plain\;charset=utf-8)))
:group 'killing)
(defun gui--selection-value-internal (type)
@@ -169,7 +170,7 @@ decided by `x-select-request-type'. The return value is
already
decoded. If `gui-get-selection' signals an error, return nil."
(let ((request-type (if (memq window-system '(x pgtk))
(or x-select-request-type
- '(UTF8_STRING COMPOUND_TEXT STRING text/plain))
+ '(UTF8_STRING COMPOUND_TEXT STRING
text/plain\;charset=utf-8))
'STRING))
text)
(with-demoted-errors "gui-get-selection: %S"
@@ -305,6 +306,7 @@ the formats available in the clipboard if TYPE is
`CLIPBOARD'."
selection-coding-system
(pcase data-type
('UTF8_STRING 'utf-8)
+ ('text/plain\;charset=utf-8 'utf-8)
('COMPOUND_TEXT 'compound-text-with-extensions)
('C_STRING nil)
('STRING 'iso-8859-1)
diff --git a/src/pgtkselect.c b/src/pgtkselect.c
index 469e42f..7b7bc69 100644
--- a/src/pgtkselect.c
+++ b/src/pgtkselect.c
@@ -576,6 +576,8 @@ On PGTK, TIME-STAMP is unused. */)
lispy_type = QCOMPOUND_TEXT;
else if (sd_type == gdk_atom_intern("UTF8_STRING", false))
lispy_type = QUTF8_STRING;
+ else if (sd_type == gdk_atom_intern("text/plain;charset=utf-8", false))
+ lispy_type = Qtext_plain_charset_utf_8;
else
lispy_type = QSTRING;
Fput_text_property (make_fixnum (0), make_fixnum (sd_len),
@@ -611,6 +613,7 @@ syms_of_pgtkselect (void)
DEFSYM (QUTF8_STRING, "UTF8_STRING");
DEFSYM (QSTRING, "STRING");
DEFSYM (QCOMPOUND_TEXT, "COMPOUND_TEXT");
+ DEFSYM (Qtext_plain_charset_utf_8, "text/plain;charset=utf-8");
defsubr (&Spgtk_disown_selection_internal);
defsubr (&Spgtk_get_selection_internal);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/pgtk 565995d: Fix unicode strings can't be pasted correctly,
Yuuki Harano <=