Mercurial > emacs
changeset 106811:b727bf889482
Display buffer name, etc. in mode line by composing correctly.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 13 Jan 2010 10:40:39 +0900 |
parents | 5cb0f4fd512e (current diff) 387093451b82 (diff) |
children | 23c562723a8d 4040ecb0c904 |
files | |
diffstat | 4 files changed, 52 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Jan 13 00:55:23 2010 +0100 +++ b/src/ChangeLog Wed Jan 13 10:40:39 2010 +0900 @@ -1,3 +1,21 @@ +2010-01-13 Kenichi Handa <handa@m17n.org> + + Display buffer name, etc. in mode line by composing correctly. + + * xdisp.c (reseat_to_string): Call composition_compute_stop_pos if + STRING is not nil. + (display_mode_element): Adjusted for the change of + decode_mode_spec and display_line. + (decode_mode_spec): Change arg MULTIBYTE to STRING. + (display_string): Handle the case that STRING is non-null and + LISP_STRING is not nil. + + * xterm.c (x_draw_composite_glyph_string_foreground): Pay + attention to s->face->overstrike. + + * composite.c (composition_reseat_it): Don't check PT if STRING is + non nil. + 2010-01-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> * keyboard.c (read_char): Don't apply previous change when current
--- a/src/composite.c Wed Jan 13 00:55:23 2010 +0100 +++ b/src/composite.c Wed Jan 13 10:40:39 2010 +0900 @@ -1104,7 +1104,7 @@ struct face *face; Lisp_Object string; { - if (charpos < PT && PT < endpos) + if (NILP (string) && charpos < PT && PT < endpos) endpos = PT; if (cmp_it->ch == -2)
--- a/src/xdisp.c Wed Jan 13 00:55:23 2010 +0100 +++ b/src/xdisp.c Wed Jan 13 10:40:39 2010 +0900 @@ -953,7 +953,8 @@ static int display_mode_line P_ ((struct window *, enum face_id, Lisp_Object)); static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object, Lisp_Object, int)); static int store_mode_line_string P_ ((char *, Lisp_Object, int, int, int, Lisp_Object)); -static char *decode_mode_spec P_ ((struct window *, int, int, int, int *)); +static char *decode_mode_spec P_ ((struct window *, int, int, int, + Lisp_Object *)); static void display_menu_bar P_ ((struct window *)); static int display_count_lines P_ ((int, int, int, int, int *)); static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object, @@ -5607,6 +5608,9 @@ it->dp = XCHAR_TABLE (Vstandard_display_table); it->stop_charpos = charpos; + if (s == NULL && it->multibyte_p) + composition_compute_stop_pos (&it->cmp_it, charpos, -1, it->end_charpos, + it->string); CHECK_IT (it); } @@ -17576,13 +17580,14 @@ int multibyte; int bytepos, charpos; unsigned char *spec; + Lisp_Object string; bytepos = percent_position; charpos = (STRING_MULTIBYTE (elt) ? string_byte_to_char (elt, bytepos) : bytepos); - spec - = decode_mode_spec (it->w, c, field, prec, &multibyte); + spec = decode_mode_spec (it->w, c, field, prec, &string); + multibyte = STRINGP (string) && STRING_MULTIBYTE (string); switch (mode_line_target) { @@ -17604,7 +17609,7 @@ int nglyphs_before, nwritten; nglyphs_before = it->glyph_row->used[TEXT_AREA]; - nwritten = display_string (spec, Qnil, elt, + nwritten = display_string (spec, string, elt, charpos, 0, it, field, prec, 0, multibyte); @@ -18267,8 +18272,8 @@ /* Return a string for the output of a mode line %-spec for window W, generated by character C. PRECISION >= 0 means don't return a string longer than that value. FIELD_WIDTH > 0 means pad the - string returned with spaces to that value. Return 1 in *MULTIBYTE - if the result is multibyte text. + string returned with spaces to that value. Return a Lisp string in + *STRING if the resulting string is taken from that Lisp string. Note we operate on the current buffer for most purposes, the exception being w->base_line_pos. */ @@ -18276,11 +18281,11 @@ static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------"; static char * -decode_mode_spec (w, c, field_width, precision, multibyte) +decode_mode_spec (w, c, field_width, precision, string) struct window *w; register int c; int field_width, precision; - int *multibyte; + Lisp_Object *string; { Lisp_Object obj; struct frame *f = XFRAME (WINDOW_FRAME (w)); @@ -18288,7 +18293,7 @@ struct buffer *b = current_buffer; obj = Qnil; - *multibyte = 0; + *string = Qnil; switch (c) { @@ -18682,7 +18687,7 @@ if (STRINGP (obj)) { - *multibyte = STRING_MULTIBYTE (obj); + *string = obj; return (char *) SDATA (obj); } else @@ -18803,7 +18808,10 @@ /* Display a NUL-terminated string, starting with index START. If STRING is non-null, display that C string. Otherwise, the Lisp - string LISP_STRING is displayed. + string LISP_STRING is displayed. There's a case that STRING is + non-null and LISP_STRING is not nil. It means STRING is a string + data of LISP_STRING. In that case, we display LISP_STRING while + ignoring its text properties. If FACE_STRING is not nil, FACE_STRING_POS is a position in FACE_STRING. Display STRING or LISP_STRING with the face at @@ -18853,8 +18861,12 @@ /* Initialize the iterator IT for iteration over STRING beginning with index START. */ - reseat_to_string (it, string, lisp_string, start, + reseat_to_string (it, NILP (lisp_string) ? string : NULL, lisp_string, start, precision, field_width, multibyte); + if (string && STRINGP (lisp_string)) + /* LISP_STRING is the one returned by decode_mode_spec. We should + ignore its text properties. */ + it->stop_charpos = -1; /* If displaying STRING, set up the face of the iterator from LISP_STRING, if that's given. */
--- a/src/xterm.c Wed Jan 13 00:55:23 2010 +0100 +++ b/src/xterm.c Wed Jan 13 10:40:39 2010 +0900 @@ -1378,19 +1378,27 @@ if (j < i) { font->driver->draw (s, j, i, x, y, 0); + if (s->face->overstrike) + font->driver->draw (s, j, i, x + 1, y, 0); x += width; } xoff = LGLYPH_XOFF (glyph); yoff = LGLYPH_YOFF (glyph); wadjust = LGLYPH_WADJUST (glyph); font->driver->draw (s, i, i + 1, x + xoff, y + yoff, 0); + if (s->face->overstrike) + font->driver->draw (s, i, i + 1, x + xoff + 1, y + yoff, 0); x += wadjust; j = i + 1; width = 0; } } if (j < i) - font->driver->draw (s, j, i, x, y, 0); + { + font->driver->draw (s, j, i, x, y, 0); + if (s->face->overstrike) + font->driver->draw (s, j, i, x + 1, y, 0); + } } }