diff options
| author | Kenichi Handa | 2010-08-31 16:49:21 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-08-31 16:49:21 +0900 |
| commit | d419e1d94e885388b86f8753d741befa1855d333 (patch) | |
| tree | d907b7c8e384e459dbf027179d7710fba43837d0 /src/term.c | |
| parent | b295da470123c7beea983f9b500db5286fd12996 (diff) | |
| download | emacs-d419e1d94e885388b86f8753d741befa1855d333.tar.gz emacs-d419e1d94e885388b86f8753d741befa1855d333.zip | |
Fix handling of 8-bit characters in a display table.
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/src/term.c b/src/term.c index 868b596dc1a..b67d93f5b5b 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -695,12 +695,8 @@ encode_terminal_code (src, src_len, coding) | |||
| 695 | encode_terminal_src_size); | 695 | encode_terminal_src_size); |
| 696 | buf = encode_terminal_src + nbytes; | 696 | buf = encode_terminal_src + nbytes; |
| 697 | } | 697 | } |
| 698 | if (CHAR_BYTE8_P (c)) | 698 | if (CHAR_BYTE8_P (c) |
| 699 | { | 699 | || char_charset (c, charset_list, NULL)) |
| 700 | *buf++ = CHAR_TO_BYTE8 (c); | ||
| 701 | nchars++; | ||
| 702 | } | ||
| 703 | else if (char_charset (c, charset_list, NULL)) | ||
| 704 | { | 700 | { |
| 705 | /* Store the multibyte form of C at BUF. */ | 701 | /* Store the multibyte form of C at BUF. */ |
| 706 | buf += CHAR_STRING (c, buf); | 702 | buf += CHAR_STRING (c, buf); |
| @@ -1610,18 +1606,15 @@ produce_glyphs (it) | |||
| 1610 | goto done; | 1606 | goto done; |
| 1611 | } | 1607 | } |
| 1612 | 1608 | ||
| 1613 | /* Maybe translate single-byte characters to multibyte. */ | 1609 | if (it->char_to_display >= 040 && it->char_to_display < 0177) |
| 1614 | it->char_to_display = it->c; | ||
| 1615 | |||
| 1616 | if (it->c >= 040 && it->c < 0177) | ||
| 1617 | { | 1610 | { |
| 1618 | it->pixel_width = it->nglyphs = 1; | 1611 | it->pixel_width = it->nglyphs = 1; |
| 1619 | if (it->glyph_row) | 1612 | if (it->glyph_row) |
| 1620 | append_glyph (it); | 1613 | append_glyph (it); |
| 1621 | } | 1614 | } |
| 1622 | else if (it->c == '\n') | 1615 | else if (it->char_to_display == '\n') |
| 1623 | it->pixel_width = it->nglyphs = 0; | 1616 | it->pixel_width = it->nglyphs = 0; |
| 1624 | else if (it->c == '\t') | 1617 | else if (it->char_to_display == '\t') |
| 1625 | { | 1618 | { |
| 1626 | int absolute_x = (it->current_x | 1619 | int absolute_x = (it->current_x |
| 1627 | + it->continuation_lines_width); | 1620 | + it->continuation_lines_width); |
| @@ -1652,32 +1645,19 @@ produce_glyphs (it) | |||
| 1652 | it->pixel_width = nspaces; | 1645 | it->pixel_width = nspaces; |
| 1653 | it->nglyphs = nspaces; | 1646 | it->nglyphs = nspaces; |
| 1654 | } | 1647 | } |
| 1655 | else if (CHAR_BYTE8_P (it->c)) | 1648 | else if (CHAR_BYTE8_P (it->char_to_display)) |
| 1656 | { | 1649 | { |
| 1657 | if (unibyte_display_via_language_environment | 1650 | /* Coming here means that we must send the raw 8-bit byte as is |
| 1658 | && (it->c >= 0240)) | 1651 | to the terminal. Although there's no way to know how many |
| 1659 | { | 1652 | columns it occupies on a screen, it is a good assumption that |
| 1660 | it->char_to_display = BYTE8_TO_CHAR (it->c); | 1653 | a single byte code has 1-column width. */ |
| 1661 | it->pixel_width = CHAR_WIDTH (it->char_to_display); | 1654 | it->pixel_width = it->nglyphs = 1; |
| 1662 | it->nglyphs = it->pixel_width; | 1655 | if (it->glyph_row) |
| 1663 | if (it->glyph_row) | 1656 | append_glyph (it); |
| 1664 | append_glyph (it); | ||
| 1665 | } | ||
| 1666 | else | ||
| 1667 | { | ||
| 1668 | /* Coming here means that it->c is from display table, thus | ||
| 1669 | we must send the raw 8-bit byte as is to the terminal. | ||
| 1670 | Although there's no way to know how many columns it | ||
| 1671 | occupies on a screen, it is a good assumption that a | ||
| 1672 | single byte code has 1-column width. */ | ||
| 1673 | it->pixel_width = it->nglyphs = 1; | ||
| 1674 | if (it->glyph_row) | ||
| 1675 | append_glyph (it); | ||
| 1676 | } | ||
| 1677 | } | 1657 | } |
| 1678 | else | 1658 | else |
| 1679 | { | 1659 | { |
| 1680 | it->pixel_width = CHAR_WIDTH (it->c); | 1660 | it->pixel_width = CHAR_WIDTH (it->char_to_display); |
| 1681 | it->nglyphs = it->pixel_width; | 1661 | it->nglyphs = it->pixel_width; |
| 1682 | 1662 | ||
| 1683 | if (it->glyph_row) | 1663 | if (it->glyph_row) |
| @@ -1892,7 +1872,7 @@ produce_special_glyphs (it, what) | |||
| 1892 | else | 1872 | else |
| 1893 | abort (); | 1873 | abort (); |
| 1894 | 1874 | ||
| 1895 | temp_it.c = GLYPH_CHAR (glyph); | 1875 | temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph); |
| 1896 | temp_it.face_id = GLYPH_FACE (glyph); | 1876 | temp_it.face_id = GLYPH_FACE (glyph); |
| 1897 | temp_it.len = CHAR_BYTES (temp_it.c); | 1877 | temp_it.len = CHAR_BYTES (temp_it.c); |
| 1898 | 1878 | ||