Display buffer name, etc. in mode line by composing correctly.

This commit is contained in:
Kenichi Handa 2010-01-13 10:29:58 +09:00
parent d8b8451f8e
commit dc954cb273
4 changed files with 52 additions and 14 deletions

View file

@ -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-11 Chong Yidong <cyd@stupidchicken.com>
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before

View file

@ -1104,7 +1104,7 @@ composition_reseat_it (cmp_it, charpos, bytepos, endpos, w, face, string)
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)

View file

@ -953,7 +953,8 @@ static int display_mode_lines P_ ((struct window *));
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 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte)
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 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
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 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
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 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
/* 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 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
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 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
struct buffer *b = current_buffer;
obj = Qnil;
*multibyte = 0;
*string = Qnil;
switch (c)
{
@ -18682,7 +18687,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
if (STRINGP (obj))
{
*multibyte = STRING_MULTIBYTE (obj);
*string = obj;
return (char *) SDATA (obj);
}
else
@ -18803,7 +18808,10 @@ display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr)
/* 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 @@ display_string (string, lisp_string, face_string, face_string_pos,
/* 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. */

View file

@ -1378,19 +1378,27 @@ x_draw_composite_glyph_string_foreground (s)
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);
}
}
}