10759 |
int string_before_pos; |
int string_before_pos; |
10760 |
int x = row->x; |
int x = row->x; |
10761 |
int cursor_x = x; |
int cursor_x = x; |
10762 |
|
int cursor_from_overlay_pos = 0; |
10763 |
int pt_old = PT - delta; |
int pt_old = PT - delta; |
10764 |
|
|
10765 |
/* Skip over glyphs not having an object at the start of the row. |
/* Skip over glyphs not having an object at the start of the row. |
10785 |
string_start = NULL; |
string_start = NULL; |
10786 |
x += glyph->pixel_width; |
x += glyph->pixel_width; |
10787 |
++glyph; |
++glyph; |
10788 |
|
if (cursor_from_overlay_pos |
10789 |
|
&& last_pos > cursor_from_overlay_pos) |
10790 |
|
{ |
10791 |
|
cursor_from_overlay_pos = 0; |
10792 |
|
cursor = 0; |
10793 |
|
} |
10794 |
} |
} |
10795 |
else |
else |
10796 |
{ |
{ |
10800 |
/* Skip all glyphs from string. */ |
/* Skip all glyphs from string. */ |
10801 |
do |
do |
10802 |
{ |
{ |
10803 |
|
int pos; |
10804 |
if ((cursor == NULL || glyph > cursor) |
if ((cursor == NULL || glyph > cursor) |
10805 |
&& !NILP (Fget_char_property (make_number ((glyph)->charpos), |
&& !NILP (Fget_char_property (make_number ((glyph)->charpos), |
10806 |
Qcursor, (glyph)->object))) |
Qcursor, (glyph)->object)) |
10807 |
|
&& (pos = string_buffer_position (w, glyph->object, |
10808 |
|
string_before_pos), |
10809 |
|
(pos == 0 /* From overlay */ |
10810 |
|
|| pos == pt_old))) |
10811 |
{ |
{ |
10812 |
|
/* Estimate overlay buffer position from the buffer |
10813 |
|
positions of the glyphs before and after the overlay. |
10814 |
|
Add 1 to last_pos so that if point corresponds to the |
10815 |
|
glyph right after the overlay, we still use a 'cursor' |
10816 |
|
property found in that overlay. */ |
10817 |
|
cursor_from_overlay_pos = pos == 0 ? last_pos+1 : 0; |
10818 |
cursor = glyph; |
cursor = glyph; |
10819 |
cursor_x = x; |
cursor_x = x; |
10820 |
} |
} |
15894 |
|
|
15895 |
|
|
15896 |
DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, |
DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, |
15897 |
0, 3, 0, |
0, 4, 0, |
15898 |
doc: /* Return the mode-line of selected window as a string. |
doc: /* Return the mode-line of selected window as a string. |
15899 |
First optional arg FORMAT specifies a different format string (see |
First optional arg FORMAT specifies a different format string (see |
15900 |
`mode-line-format' for details) to use. If FORMAT is t, return |
`mode-line-format' for details) to use. If FORMAT is t, return |
15901 |
the buffer's header-line. Second optional arg WINDOW specifies a |
the buffer's header-line. Second optional arg WINDOW specifies a |
15902 |
different window to use as the context for the formatting. |
different window to use as the context for the formatting. |
15903 |
If third optional arg NO-PROPS is non-nil, string is not propertized. */) |
If third optional arg NO-PROPS is non-nil, string is not propertized. |
15904 |
(format, window, no_props) |
Fourth optional arg BUFFER specifies which buffer to use. */) |
15905 |
Lisp_Object format, window, no_props; |
(format, window, no_props, buffer) |
15906 |
|
Lisp_Object format, window, no_props, buffer; |
15907 |
{ |
{ |
15908 |
struct it it; |
struct it it; |
15909 |
int len; |
int len; |
15915 |
window = selected_window; |
window = selected_window; |
15916 |
CHECK_WINDOW (window); |
CHECK_WINDOW (window); |
15917 |
w = XWINDOW (window); |
w = XWINDOW (window); |
|
CHECK_BUFFER (w->buffer); |
|
15918 |
|
|
15919 |
if (XBUFFER (w->buffer) != current_buffer) |
if (NILP (buffer)) |
15920 |
|
buffer = w->buffer; |
15921 |
|
|
15922 |
|
CHECK_BUFFER (buffer); |
15923 |
|
|
15924 |
|
if (XBUFFER (buffer) != current_buffer) |
15925 |
{ |
{ |
15926 |
old_buffer = current_buffer; |
old_buffer = current_buffer; |
15927 |
set_buffer_internal_1 (XBUFFER (w->buffer)); |
set_buffer_internal_1 (XBUFFER (buffer)); |
15928 |
} |
} |
15929 |
|
|
15930 |
if (NILP (format) || EQ (format, Qt)) |
if (NILP (format) || EQ (format, Qt)) |