aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorKenichi Handa2006-02-07 01:19:06 +0000
committerKenichi Handa2006-02-07 01:19:06 +0000
commitd2b4c17d26022daf1a2b3f6ca4f727a23711622d (patch)
treeef078da1a764d4e24faf26b2dc6b92ed99f668dd /src/term.c
parentea37fbb817c487fea0ca3691df0b9ae70e86d5be (diff)
downloademacs-d2b4c17d26022daf1a2b3f6ca4f727a23711622d.tar.gz
emacs-d2b4c17d26022daf1a2b3f6ca4f727a23711622d.zip
(append_glyph): Refer to it->char_to_display instead of
it->c. (produce_glyphs): Set the character to print in it->char_to_display. Handle unibyte-display-via-language-environment. (produce_stretch_glyph): Set the character to print in it->char_to_display.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c53
1 files changed, 34 insertions, 19 deletions
diff --git a/src/term.c b/src/term.c
index 8c6250c522e..2b44653b961 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1634,10 +1634,10 @@ static void produce_stretch_glyph P_ ((struct it *));
1634 1634
1635 1635
1636/* Append glyphs to IT's glyph_row. Called from produce_glyphs for 1636/* Append glyphs to IT's glyph_row. Called from produce_glyphs for
1637 terminal frames if IT->glyph_row != NULL. IT->c is the character 1637 terminal frames if IT->glyph_row != NULL. IT->char_to_display is
1638 for which to produce glyphs; IT->face_id contains the character's 1638 the character for which to produce glyphs; IT->face_id contains the
1639 face. Padding glyphs are appended if IT->c has a IT->pixel_width > 1639 character's face. Padding glyphs are appended if IT->c has a
1640 1. */ 1640 IT->pixel_width > 1. */
1641 1641
1642static void 1642static void
1643append_glyph (it) 1643append_glyph (it)
@@ -1657,7 +1657,7 @@ append_glyph (it)
1657 { 1657 {
1658 glyph->type = CHAR_GLYPH; 1658 glyph->type = CHAR_GLYPH;
1659 glyph->pixel_width = 1; 1659 glyph->pixel_width = 1;
1660 glyph->u.ch = it->c; 1660 glyph->u.ch = it->char_to_display;
1661 glyph->face_id = it->face_id; 1661 glyph->face_id = it->face_id;
1662 glyph->padding_p = i > 0; 1662 glyph->padding_p = i > 0;
1663 glyph->charpos = CHARPOS (it->position); 1663 glyph->charpos = CHARPOS (it->position);
@@ -1708,6 +1708,9 @@ produce_glyphs (it)
1708 xassert (it->what == IT_CHARACTER 1708 xassert (it->what == IT_CHARACTER
1709 || it->what == IT_COMPOSITION); 1709 || it->what == IT_COMPOSITION);
1710 1710
1711 /* Maybe translate single-byte characters to multibyte. */
1712 it->char_to_display = it->c;
1713
1711 if (it->c >= 040 && it->c < 0177) 1714 if (it->c >= 040 && it->c < 0177)
1712 { 1715 {
1713 it->pixel_width = it->nglyphs = 1; 1716 it->pixel_width = it->nglyphs = 1;
@@ -1737,13 +1740,11 @@ produce_glyphs (it)
1737 { 1740 {
1738 int n = nspaces; 1741 int n = nspaces;
1739 1742
1740 it->c = ' '; 1743 it->char_to_display = ' ';
1741 it->pixel_width = it->len = 1; 1744 it->pixel_width = it->len = 1;
1742 1745
1743 while (n--) 1746 while (n--)
1744 append_glyph (it); 1747 append_glyph (it);
1745
1746 it->c = '\t';
1747 } 1748 }
1748 1749
1749 it->pixel_width = nspaces; 1750 it->pixel_width = nspaces;
@@ -1751,14 +1752,30 @@ produce_glyphs (it)
1751 } 1752 }
1752 else if (SINGLE_BYTE_CHAR_P (it->c)) 1753 else if (SINGLE_BYTE_CHAR_P (it->c))
1753 { 1754 {
1754 /* Coming here means that it->c is from display table, thus we 1755 if (unibyte_display_via_language_environment
1755 must send the code as is to the terminal. Although there's 1756 && (it->c >= 0240
1756 no way to know how many columns it occupies on a screen, it 1757 || !NILP (Vnonascii_translation_table)))
1757 is a good assumption that a single byte code has 1-column 1758 {
1758 width. */ 1759 int charset;
1759 it->pixel_width = it->nglyphs = 1; 1760
1760 if (it->glyph_row) 1761 it->char_to_display = unibyte_char_to_multibyte (it->c);
1761 append_glyph (it); 1762 charset = CHAR_CHARSET (it->char_to_display);
1763 it->pixel_width = CHARSET_WIDTH (charset);
1764 it->nglyphs = it->pixel_width;
1765 if (it->glyph_row)
1766 append_glyph (it);
1767 }
1768 else
1769 {
1770 /* Coming here means that it->c is from display table, thus we
1771 must send the code as is to the terminal. Although there's
1772 no way to know how many columns it occupies on a screen, it
1773 is a good assumption that a single byte code has 1-column
1774 width. */
1775 it->pixel_width = it->nglyphs = 1;
1776 if (it->glyph_row)
1777 append_glyph (it);
1778 }
1762 } 1779 }
1763 else 1780 else
1764 { 1781 {
@@ -1843,17 +1860,15 @@ produce_stretch_glyph (it)
1843 Lisp_Object o_object = it->object; 1860 Lisp_Object o_object = it->object;
1844 Lisp_Object object = it->stack[it->sp - 1].string; 1861 Lisp_Object object = it->stack[it->sp - 1].string;
1845 int n = width; 1862 int n = width;
1846 int c = it->c;
1847 1863
1848 if (!STRINGP (object)) 1864 if (!STRINGP (object))
1849 object = it->w->buffer; 1865 object = it->w->buffer;
1850 it->object = object; 1866 it->object = object;
1851 it->c = ' '; 1867 it->char_to_display = ' ';
1852 it->pixel_width = it->len = 1; 1868 it->pixel_width = it->len = 1;
1853 while (n--) 1869 while (n--)
1854 append_glyph (it); 1870 append_glyph (it);
1855 it->object = o_object; 1871 it->object = o_object;
1856 it->c = c;
1857 } 1872 }
1858 it->pixel_width = width; 1873 it->pixel_width = width;
1859 it->nglyphs = width; 1874 it->nglyphs = width;