diff options
| author | Kenichi Handa | 2007-03-06 05:50:48 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-03-06 05:50:48 +0000 |
| commit | a28a315a558b6a37cee6cf89bf718acfc23ba5c8 (patch) | |
| tree | b1bc1524520a84bd452461d02ae3995564839257 | |
| parent | 6f2426638b422cac0a54f20ec448d165dacc7801 (diff) | |
| download | emacs-a28a315a558b6a37cee6cf89bf718acfc23ba5c8.tar.gz emacs-a28a315a558b6a37cee6cf89bf718acfc23ba5c8.zip | |
(x-select-utf8-or-ctext): Improve the strategy.
| -rw-r--r-- | lisp/term/x-win.el | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index d9dc41cdcb8..e48d97d6d1b 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el | |||
| @@ -2198,11 +2198,12 @@ order until succeed.") | |||
| 2198 | ;; (1) If their lengthes are different, select the longer one. This | 2198 | ;; (1) If their lengthes are different, select the longer one. This |
| 2199 | ;; is because an X client may just cut off unsupported characters. | 2199 | ;; is because an X client may just cut off unsupported characters. |
| 2200 | ;; | 2200 | ;; |
| 2201 | ;; (2) Otherwise, if the Nth character of CTEXT is an ASCII | 2201 | ;; (2) Otherwise, if they are different at Nth character, and that |
| 2202 | ;; character that is different from the Nth character of UTF8, | 2202 | ;; of UTF8 is a Latin character and that of CTEXT belongs to a CJK |
| 2203 | ;; select UTF8. This is because an X client may replace unsupported | 2203 | ;; character set, select UTF8. Also select UTF8 if the Nth |
| 2204 | ;; characters with some ASCII character (typically ` ' or `?') in | 2204 | ;; character of UTF8 is non-ASCII where as that of CTEXT is ASCII. |
| 2205 | ;; CTEXT. | 2205 | ;; This is because an X client may replace unsupported characters |
| 2206 | ;; with some ASCII character (typically ` ' or `?') in CTEXT. | ||
| 2206 | ;; | 2207 | ;; |
| 2207 | ;; (3) Otherwise, select CTEXT. This is because legacy charsets are | 2208 | ;; (3) Otherwise, select CTEXT. This is because legacy charsets are |
| 2208 | ;; better for the current Emacs, especially when the selection owner | 2209 | ;; better for the current Emacs, especially when the selection owner |
| @@ -2217,10 +2218,16 @@ order until succeed.") | |||
| 2217 | (if (/= len-utf8 len-ctext) | 2218 | (if (/= len-utf8 len-ctext) |
| 2218 | (if (> len-utf8 len-ctext) utf8 ctext) | 2219 | (if (> len-utf8 len-ctext) utf8 ctext) |
| 2219 | (let ((result (compare-strings utf8 0 len-utf8 ctext 0 len-ctext))) | 2220 | (let ((result (compare-strings utf8 0 len-utf8 ctext 0 len-ctext))) |
| 2220 | (if (or (eq result t) | 2221 | (if (eq result t) |
| 2221 | (>= (aref ctext (1- (abs result))) 128)) | ||
| 2222 | ctext | 2222 | ctext |
| 2223 | utf8))))) | 2223 | (let ((utf8-char (aref utf8 (1- (abs result)))) |
| 2224 | (ctext-char (aref ctext (1- (abs result))))) | ||
| 2225 | (if (or (and (aref (char-category-set utf8-char) ?l) | ||
| 2226 | (aref (char-category-set ctext-char) ?C)) | ||
| 2227 | (and (>= utf8-char 128) | ||
| 2228 | (< ctext-char 128))) | ||
| 2229 | utf8 | ||
| 2230 | ctext))))))) | ||
| 2224 | 2231 | ||
| 2225 | ;; Get a selection value of type TYPE by calling x-get-selection with | 2232 | ;; Get a selection value of type TYPE by calling x-get-selection with |
| 2226 | ;; an appropiate DATA-TYPE argument decidd by `x-select-request-type'. | 2233 | ;; an appropiate DATA-TYPE argument decidd by `x-select-request-type'. |