Commit dc954cb2 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

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

parent d8b8451f
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> 2010-01-11 Chong Yidong <cyd@stupidchicken.com>
   
* nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before * nsterm.m (syms_of_nsterm): Initialize Qcontrol etc. before
......
...@@ -1104,7 +1104,7 @@ composition_reseat_it (cmp_it, charpos, bytepos, endpos, w, face, string) ...@@ -1104,7 +1104,7 @@ composition_reseat_it (cmp_it, charpos, bytepos, endpos, w, face, string)
struct face *face; struct face *face;
Lisp_Object string; Lisp_Object string;
{ {
if (charpos < PT && PT < endpos) if (NILP (string) && charpos < PT && PT < endpos)
endpos = PT; endpos = PT;
if (cmp_it->ch == -2) if (cmp_it->ch == -2)
......
...@@ -953,7 +953,8 @@ static int display_mode_lines P_ ((struct window *)); ...@@ -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_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 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 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 void display_menu_bar P_ ((struct window *));
static int display_count_lines P_ ((int, int, int, int, int *)); static int display_count_lines P_ ((int, int, int, int, int *));
static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object, 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) ...@@ -5607,6 +5608,9 @@ reseat_to_string (it, s, string, charpos, precision, field_width, multibyte)
it->dp = XCHAR_TABLE (Vstandard_display_table); it->dp = XCHAR_TABLE (Vstandard_display_table);
   
it->stop_charpos = charpos; 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); CHECK_IT (it);
} }
   
...@@ -17576,13 +17580,14 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) ...@@ -17576,13 +17580,14 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
int multibyte; int multibyte;
int bytepos, charpos; int bytepos, charpos;
unsigned char *spec; unsigned char *spec;
Lisp_Object string;
   
bytepos = percent_position; bytepos = percent_position;
charpos = (STRING_MULTIBYTE (elt) charpos = (STRING_MULTIBYTE (elt)
? string_byte_to_char (elt, bytepos) ? string_byte_to_char (elt, bytepos)
: bytepos); : bytepos);
spec spec = decode_mode_spec (it->w, c, field, prec, &string);
= decode_mode_spec (it->w, c, field, prec, &multibyte); multibyte = STRINGP (string) && STRING_MULTIBYTE (string);
   
switch (mode_line_target) switch (mode_line_target)
{ {
...@@ -17604,7 +17609,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) ...@@ -17604,7 +17609,7 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
int nglyphs_before, nwritten; int nglyphs_before, nwritten;
   
nglyphs_before = it->glyph_row->used[TEXT_AREA]; nglyphs_before = it->glyph_row->used[TEXT_AREA];
nwritten = display_string (spec, Qnil, elt, nwritten = display_string (spec, string, elt,
charpos, 0, it, charpos, 0, it,
field, prec, 0, field, prec, 0,
multibyte); multibyte);
...@@ -18267,8 +18272,8 @@ decode_mode_spec_coding (coding_system, buf, eol_flag) ...@@ -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, /* 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 generated by character C. PRECISION >= 0 means don't return a
string longer than that value. FIELD_WIDTH > 0 means pad the string longer than that value. FIELD_WIDTH > 0 means pad the
string returned with spaces to that value. Return 1 in *MULTIBYTE string returned with spaces to that value. Return a Lisp string in
if the result is multibyte text. *STRING if the resulting string is taken from that Lisp string.
   
Note we operate on the current buffer for most purposes, Note we operate on the current buffer for most purposes,
the exception being w->base_line_pos. */ the exception being w->base_line_pos. */
...@@ -18276,11 +18281,11 @@ decode_mode_spec_coding (coding_system, buf, eol_flag) ...@@ -18276,11 +18281,11 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------"; static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
   
static char * static char *
decode_mode_spec (w, c, field_width, precision, multibyte) decode_mode_spec (w, c, field_width, precision, string)
struct window *w; struct window *w;
register int c; register int c;
int field_width, precision; int field_width, precision;
int *multibyte; Lisp_Object *string;
{ {
Lisp_Object obj; Lisp_Object obj;
struct frame *f = XFRAME (WINDOW_FRAME (w)); struct frame *f = XFRAME (WINDOW_FRAME (w));
...@@ -18288,7 +18293,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte) ...@@ -18288,7 +18293,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
struct buffer *b = current_buffer; struct buffer *b = current_buffer;
   
obj = Qnil; obj = Qnil;
*multibyte = 0; *string = Qnil;
   
switch (c) switch (c)
{ {
...@@ -18682,7 +18687,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte) ...@@ -18682,7 +18687,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
   
if (STRINGP (obj)) if (STRINGP (obj))
{ {
*multibyte = STRING_MULTIBYTE (obj); *string = obj;
return (char *) SDATA (obj); return (char *) SDATA (obj);
} }
else else
...@@ -18803,7 +18808,10 @@ display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr) ...@@ -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. /* Display a NUL-terminated string, starting with index START.
   
If STRING is non-null, display that C string. Otherwise, the Lisp 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 If FACE_STRING is not nil, FACE_STRING_POS is a position in
FACE_STRING. Display STRING or LISP_STRING with the face at 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, ...@@ -18853,8 +18861,12 @@ display_string (string, lisp_string, face_string, face_string_pos,
   
/* Initialize the iterator IT for iteration over STRING beginning /* Initialize the iterator IT for iteration over STRING beginning
with index START. */ 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); 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 /* If displaying STRING, set up the face of the iterator
from LISP_STRING, if that's given. */ from LISP_STRING, if that's given. */
......
...@@ -1378,19 +1378,27 @@ x_draw_composite_glyph_string_foreground (s) ...@@ -1378,19 +1378,27 @@ x_draw_composite_glyph_string_foreground (s)
if (j < i) 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);
x += width; x += width;
} }
xoff = LGLYPH_XOFF (glyph); xoff = LGLYPH_XOFF (glyph);
yoff = LGLYPH_YOFF (glyph); yoff = LGLYPH_YOFF (glyph);
wadjust = LGLYPH_WADJUST (glyph); wadjust = LGLYPH_WADJUST (glyph);
font->driver->draw (s, i, i + 1, x + xoff, y + yoff, 0); 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; x += wadjust;
j = i + 1; j = i + 1;
width = 0; width = 0;
} }
} }
if (j < i) 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);
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment