aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorEli Zaretskii2010-11-13 15:29:31 +0200
committerEli Zaretskii2010-11-13 15:29:31 +0200
commit0eb025fb55277c038c39e7325a556de46ecbd2e4 (patch)
tree677650021eae4915030d38baabe6c872eaa31845 /src/term.c
parent6e060cee8186d9fe5ad5f8a783d45f80f9b1bbe3 (diff)
downloademacs-0eb025fb55277c038c39e7325a556de46ecbd2e4.tar.gz
emacs-0eb025fb55277c038c39e7325a556de46ecbd2e4.zip
Fix and document display of glyphless characters.
src/xdisp.c (set_cursor_from_row): Fix cursor positioning on zero-width characters. (syms_of_xdisp) <glyphless-char-display>: Doc fix. src/.gdbinit (pgx): Adapt to latest changes in `struct glyph'. src/w32term.c (x_draw_glyphless_glyph_string_foreground): Draw the box before drawing the glyphs inside it. src/dispextern.h (enum glyphless_display_method): Rename GLYPHLESS_DISPLAY_HEXA_CODE to GLYPHLESS_DISPLAY_HEX_CODE. All users changed. src/term.c (append_glyphless_glyph, produce_glyphless_glyph): Fix comments. (produce_glyphless_glyph): Enclose "U+nnnn" and "empty box" whitespace in "[]", to simulate a box. Don't use uninitialized variable `width'. lisp/international/characters.el (glyphless-char-display-control): Renamed from glyphless-char-control; all users changed. Doc fix. Signal an error if display method is not one of the recognized symbols. doc/emacs/rmail.texi (Rmail Coding): Characters with no fonts are not necessarily displayed as empty boxes. doc/emacs/mule.texi (Language Environments, Fontsets): Characters with no fonts are not necessarily displayed as empty boxes. doc/emacs/display.texi (Text Display): Document display of glyphless characters. doc/lispref/display.texi (Usual Display): Characters with no fonts are not necessarily displayed as empty boxes. etc/NEWS: Document display of glyphless characters.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/term.c b/src/term.c
index dbbdc03f190..71df92822ac 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1850,9 +1850,9 @@ produce_composite_glyph (struct it *it)
1850 1850
1851 1851
1852/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID 1852/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID
1853 is a face ID to be used for the glyph. What actually appended are 1853 is a face ID to be used for the glyph. What is actually appended
1854 glyphs of type CHAR_GLYPH of which characters are in STR 1854 are glyphs of type CHAR_GLYPH whose characters are in STR (which
1855 (it->nglyphs bytes). */ 1855 comes from it->nglyphs bytes). */
1856 1856
1857static void 1857static void
1858append_glyphless_glyph (struct it *it, int face_id, char *str) 1858append_glyphless_glyph (struct it *it, int face_id, char *str)
@@ -1923,7 +1923,7 @@ extern Lisp_Object Qglyphless_char;
1923/* Produce glyphs for a glyphless character for iterator IT. 1923/* Produce glyphs for a glyphless character for iterator IT.
1924 IT->glyphless_method specifies which method to use for displaying 1924 IT->glyphless_method specifies which method to use for displaying
1925 the character. See the description of enum 1925 the character. See the description of enum
1926 glyphless_display_method in dispextern.h for the detail. 1926 glyphless_display_method in dispextern.h for the details.
1927 1927
1928 FOR_NO_FONT is nonzero if and only if this is for a character that 1928 FOR_NO_FONT is nonzero if and only if this is for a character that
1929 is not supproted by the coding system of the terminal. ACRONYM, if 1929 is not supproted by the coding system of the terminal. ACRONYM, if
@@ -1935,11 +1935,11 @@ static void
1935produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) 1935produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1936{ 1936{
1937 int face_id; 1937 int face_id;
1938 int width, len; 1938 int len;
1939 char buf[9], *str = " "; 1939 char buf[11], *str = " ";
1940 1940
1941 /* Get a face ID for the glyph by utilizing a cache (the same way as 1941 /* Get a face ID for the glyph by utilizing a cache (the same way as
1942 doen for `escape-glyph' in get_next_display_element). */ 1942 done for `escape-glyph' in get_next_display_element). */
1943 if (it->f == last_glyphless_glyph_frame 1943 if (it->f == last_glyphless_glyph_frame
1944 && it->face_id == last_glyphless_glyph_face_id) 1944 && it->face_id == last_glyphless_glyph_face_id)
1945 { 1945 {
@@ -1956,8 +1956,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1956 1956
1957 if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) 1957 if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
1958 { 1958 {
1959 /* As there's no way to produce a thin space, we produce 1959 /* As there's no way to produce a thin space, we produce a space
1960 a space of canonical width.. */ 1960 of canonical width. */
1961 len = 1; 1961 len = 1;
1962 } 1962 }
1963 else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) 1963 else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
@@ -1965,8 +1965,11 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1965 len = CHAR_WIDTH (it->c); 1965 len = CHAR_WIDTH (it->c);
1966 if (len == 0) 1966 if (len == 0)
1967 len = 1; 1967 len = 1;
1968 else if (width > 4) 1968 else if (len > 4)
1969 len = 4; 1969 len = 4;
1970 sprintf (buf, "[%.*s]", len, str);
1971 len += 2;
1972 str = buf;
1970 } 1973 }
1971 else 1974 else
1972 { 1975 {
@@ -1983,11 +1986,11 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1983 } 1986 }
1984 else 1987 else
1985 { 1988 {
1986 xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE); 1989 xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
1987 len = (it->c < 0x100 ? sprintf (buf, "U+%02X", it->c) 1990 len = (it->c < 0x100 ? sprintf (buf, "[U+%02X]", it->c)
1988 : it->c < 0x10000 ? sprintf (buf, "U+%04X", it->c) 1991 : it->c < 0x10000 ? sprintf (buf, "[U+%04X]", it->c)
1989 : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "U+%06X", it->c) 1992 : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "[U+%06X]", it->c)
1990 : sprintf (buf, "E+%06X", it->c)); 1993 : sprintf (buf, "[E+%06X]", it->c));
1991 } 1994 }
1992 str = buf; 1995 str = buf;
1993 } 1996 }