Mercurial > emacs
diff src/term.c @ 111526:5c986eef8f0d
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.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 13 Nov 2010 15:29:31 +0200 |
parents | d53ee71e7e89 |
children | 107fd4b37e9d |
line wrap: on
line diff
--- a/src/term.c Sat Nov 13 11:42:32 2010 +0100 +++ b/src/term.c Sat Nov 13 15:29:31 2010 +0200 @@ -1850,9 +1850,9 @@ /* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID - is a face ID to be used for the glyph. What actually appended are - glyphs of type CHAR_GLYPH of which characters are in STR - (it->nglyphs bytes). */ + is a face ID to be used for the glyph. What is actually appended + are glyphs of type CHAR_GLYPH whose characters are in STR (which + comes from it->nglyphs bytes). */ static void append_glyphless_glyph (struct it *it, int face_id, char *str) @@ -1923,7 +1923,7 @@ /* Produce glyphs for a glyphless character for iterator IT. IT->glyphless_method specifies which method to use for displaying the character. See the description of enum - glyphless_display_method in dispextern.h for the detail. + glyphless_display_method in dispextern.h for the details. FOR_NO_FONT is nonzero if and only if this is for a character that is not supproted by the coding system of the terminal. ACRONYM, if @@ -1935,11 +1935,11 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) { int face_id; - int width, len; - char buf[9], *str = " "; + int len; + char buf[11], *str = " "; /* Get a face ID for the glyph by utilizing a cache (the same way as - doen for `escape-glyph' in get_next_display_element). */ + done for `escape-glyph' in get_next_display_element). */ if (it->f == last_glyphless_glyph_frame && it->face_id == last_glyphless_glyph_face_id) { @@ -1956,8 +1956,8 @@ if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) { - /* As there's no way to produce a thin space, we produce - a space of canonical width.. */ + /* As there's no way to produce a thin space, we produce a space + of canonical width. */ len = 1; } else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) @@ -1965,8 +1965,11 @@ len = CHAR_WIDTH (it->c); if (len == 0) len = 1; - else if (width > 4) + else if (len > 4) len = 4; + sprintf (buf, "[%.*s]", len, str); + len += 2; + str = buf; } else { @@ -1983,11 +1986,11 @@ } else { - xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEXA_CODE); - len = (it->c < 0x100 ? sprintf (buf, "U+%02X", it->c) - : it->c < 0x10000 ? sprintf (buf, "U+%04X", it->c) - : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "U+%06X", it->c) - : sprintf (buf, "E+%06X", it->c)); + xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); + len = (it->c < 0x100 ? sprintf (buf, "[U+%02X]", it->c) + : it->c < 0x10000 ? sprintf (buf, "[U+%04X]", it->c) + : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "[U+%06X]", it->c) + : sprintf (buf, "[E+%06X]", it->c)); } str = buf; }