diff options
| author | Kenichi Handa | 2003-10-02 12:39:47 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-10-02 12:39:47 +0000 |
| commit | c5a518dfdc7c4c63fbcdc44f92f3090b5aef8dda (patch) | |
| tree | 400dd23f069a23237af4360a97d2d3c41327413d /src | |
| parent | 52e4738380f54778b0a01f0026a588fe8e9e246f (diff) | |
| download | emacs-c5a518dfdc7c4c63fbcdc44f92f3090b5aef8dda.tar.gz emacs-c5a518dfdc7c4c63fbcdc44f92f3090b5aef8dda.zip | |
(encode_terminal_code): Don't handle glyph-table. Check
if a character is encodable by the terminal coding system. If
not, produces proper number of `?'s. Update
terminal_encode_buffer and terminal_encode_buf_size if necessary.
(produce_glyphs): Check by CHAR_BYTE8_P, not SINGLE_BYTE_CHAR_P.
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/term.c b/src/term.c index a78ee58616e..3882842de38 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -828,6 +828,12 @@ encode_terminal_code (src, src_len, consumed) | |||
| 828 | register int tlen = GLYPH_TABLE_LENGTH; | 828 | register int tlen = GLYPH_TABLE_LENGTH; |
| 829 | register Lisp_Object *tbase = GLYPH_TABLE_BASE; | 829 | register Lisp_Object *tbase = GLYPH_TABLE_BASE; |
| 830 | struct coding_system *coding; | 830 | struct coding_system *coding; |
| 831 | Lisp_Object attrs, charset_list; | ||
| 832 | |||
| 833 | #if 1 | ||
| 834 | /* GLYPH-TABLE is not supported anymore in xdisp.c. */ | ||
| 835 | tlen = 0; | ||
| 836 | #endif | ||
| 831 | 837 | ||
| 832 | /* If terminal_coding does any conversion, use it, otherwise use | 838 | /* If terminal_coding does any conversion, use it, otherwise use |
| 833 | safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here | 839 | safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here |
| @@ -838,6 +844,8 @@ encode_terminal_code (src, src_len, consumed) | |||
| 838 | coding->destination = terminal_encode_buffer; | 844 | coding->destination = terminal_encode_buffer; |
| 839 | coding->dst_bytes = terminal_encode_buf_size; | 845 | coding->dst_bytes = terminal_encode_buf_size; |
| 840 | coding->mode |= CODING_MODE_LAST_BLOCK; | 846 | coding->mode |= CODING_MODE_LAST_BLOCK; |
| 847 | attrs = CODING_ID_ATTRS (coding->id); | ||
| 848 | charset_list = CODING_ATTR_CHARSET_LIST (attrs); | ||
| 841 | 849 | ||
| 842 | workbuf = buf = alloca (MAX_MULTIBYTE_LENGTH * src_len); | 850 | workbuf = buf = alloca (MAX_MULTIBYTE_LENGTH * src_len); |
| 843 | for (nchars = 0; src < src_end; src++) | 851 | for (nchars = 0; src < src_end; src++) |
| @@ -867,9 +875,20 @@ encode_terminal_code (src, src_len, consumed) | |||
| 867 | 875 | ||
| 868 | if (NILP (string)) | 876 | if (NILP (string)) |
| 869 | { | 877 | { |
| 870 | /* Store the multibyte form of C at BUF. */ | 878 | if (! char_charset (c, charset_list, NULL)) |
| 871 | buf += CHAR_STRING (c, buf); | 879 | { |
| 872 | nchars++; | 880 | /* C is not encodable. */ |
| 881 | int i; | ||
| 882 | |||
| 883 | for (i = CHAR_WIDTH (c) - 1; i >= 0; i--, nchars++) | ||
| 884 | *buf++ = '?'; | ||
| 885 | } | ||
| 886 | else | ||
| 887 | { | ||
| 888 | /* Store the multibyte form of C at BUF. */ | ||
| 889 | buf += CHAR_STRING (c, buf); | ||
| 890 | nchars++; | ||
| 891 | } | ||
| 873 | } | 892 | } |
| 874 | else | 893 | else |
| 875 | { | 894 | { |
| @@ -890,8 +909,10 @@ encode_terminal_code (src, src_len, consumed) | |||
| 890 | encode_coding_object (coding, Qnil, 0, 0, nchars, | 909 | encode_coding_object (coding, Qnil, 0, 0, nchars, |
| 891 | buf - workbuf, Qnil); | 910 | buf - workbuf, Qnil); |
| 892 | } | 911 | } |
| 912 | /* coding->destination may have been reallocated. */ | ||
| 893 | terminal_encode_buffer = coding->destination; | 913 | terminal_encode_buffer = coding->destination; |
| 894 | terminal_encode_buf_size = coding->dst_bytes; | 914 | if (terminal_encode_buf_size < coding->dst_bytes) |
| 915 | terminal_encode_buf_size = coding->dst_bytes; | ||
| 895 | 916 | ||
| 896 | *consumed = src - src_start; | 917 | *consumed = src - src_start; |
| 897 | return (coding->produced); | 918 | return (coding->produced); |
| @@ -1676,13 +1697,12 @@ produce_glyphs (it) | |||
| 1676 | it->pixel_width = nspaces; | 1697 | it->pixel_width = nspaces; |
| 1677 | it->nglyphs = nspaces; | 1698 | it->nglyphs = nspaces; |
| 1678 | } | 1699 | } |
| 1679 | else if (SINGLE_BYTE_CHAR_P (it->c)) | 1700 | else if (CHAR_BYTE8_P (it->c)) |
| 1680 | { | 1701 | { |
| 1681 | /* Coming here means that it->c is from display table, thus we | 1702 | /* We must send the raw 8-bit byte as is to the terminal. |
| 1682 | must send the code as is to the terminal. Although there's | 1703 | Although there's no way to know how many columns it occupies |
| 1683 | no way to know how many columns it occupies on a screen, it | 1704 | on a screen, it is a good assumption that a single byte code |
| 1684 | is a good assumption that a single byte code has 1-column | 1705 | has 1-column width. */ |
| 1685 | width. */ | ||
| 1686 | it->pixel_width = it->nglyphs = 1; | 1706 | it->pixel_width = it->nglyphs = 1; |
| 1687 | if (it->glyph_row) | 1707 | if (it->glyph_row) |
| 1688 | append_glyph (it); | 1708 | append_glyph (it); |