diff options
| author | Kenichi Handa | 1997-05-10 03:37:01 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-05-10 03:37:01 +0000 |
| commit | f78da51e8dc0b1f8e7756e6b12954d79f1cd3d1c (patch) | |
| tree | d56626d28841e6528ab7e882fda36e03aa4f28aa /src | |
| parent | 34910d41c1de3669e94f1a3deb5a1f335d5d002c (diff) | |
| download | emacs-f78da51e8dc0b1f8e7756e6b12954d79f1cd3d1c.tar.gz emacs-f78da51e8dc0b1f8e7756e6b12954d79f1cd3d1c.zip | |
(selection_data_to_lisp_data): If TYPE is `STRING'
and DATA contains 8-bit codes, decode them as Latin-1 characters.
(lisp_data_to_selection_data): Supply 4th arg TABLE as Qnil to
find_charset_in_str.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xselect.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/xselect.c b/src/xselect.c index 8a8bf362dc8..cf2fe19a4ae 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -1463,14 +1463,31 @@ selection_data_to_lisp_data (display, data, size, type, format) | |||
| 1463 | else if (format == 8) | 1463 | else if (format == 8) |
| 1464 | { | 1464 | { |
| 1465 | Lisp_Object str; | 1465 | Lisp_Object str; |
| 1466 | 1466 | int require_encoding = 0; | |
| 1467 | if (type != dpyinfo->Xatom_TEXT && type != dpyinfo->Xatom_COMPOUND_TEXT) | 1467 | |
| 1468 | /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode DATA | ||
| 1469 | to Emacs internal format because DATA may be encoded in | ||
| 1470 | compound text format. In addtion, if TYPE is `STRING' and | ||
| 1471 | DATA contains any 8-bit Latin-1 code, we should also decode | ||
| 1472 | it. */ | ||
| 1473 | if (type == dpyinfo->Xatom_TEXT || type == dpyinfo->Xatom_COMPOUND_TEXT) | ||
| 1474 | require_encoding = 1; | ||
| 1475 | else if (type == XA_STRING) | ||
| 1476 | { | ||
| 1477 | int i; | ||
| 1478 | for (i = 0; i < size; i++) | ||
| 1479 | { | ||
| 1480 | if (data[i] >= 0x80) | ||
| 1481 | { | ||
| 1482 | require_encoding = 1; | ||
| 1483 | break; | ||
| 1484 | } | ||
| 1485 | } | ||
| 1486 | } | ||
| 1487 | if (!require_encoding) | ||
| 1468 | str = make_string ((char *) data, size); | 1488 | str = make_string ((char *) data, size); |
| 1469 | else | 1489 | else |
| 1470 | { | 1490 | { |
| 1471 | /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode | ||
| 1472 | DATA to Emacs internal format because DATA may be | ||
| 1473 | encoded in compound text format. */ | ||
| 1474 | int bufsize, dummy; | 1491 | int bufsize, dummy; |
| 1475 | unsigned char *buf; | 1492 | unsigned char *buf; |
| 1476 | struct coding_system coding; | 1493 | struct coding_system coding; |
| @@ -1588,7 +1605,7 @@ lisp_data_to_selection_data (display, obj, | |||
| 1588 | bzero (charsets, MAX_CHARSET + 1); | 1605 | bzero (charsets, MAX_CHARSET + 1); |
| 1589 | num = ((*size_ret <= 1) /* Check the possibility of short cut. */ | 1606 | num = ((*size_ret <= 1) /* Check the possibility of short cut. */ |
| 1590 | ? 0 | 1607 | ? 0 |
| 1591 | : find_charset_in_str (*data_ret, *size_ret, charsets)); | 1608 | : find_charset_in_str (*data_ret, *size_ret, charsets, Qnil)); |
| 1592 | 1609 | ||
| 1593 | if (!num || (num == 1 && charsets[CHARSET_ASCII])) | 1610 | if (!num || (num == 1 && charsets[CHARSET_ASCII])) |
| 1594 | { | 1611 | { |