10659 |
int string_before_pos; |
int string_before_pos; |
10660 |
int x = row->x; |
int x = row->x; |
10661 |
int cursor_x = x; |
int cursor_x = x; |
10662 |
|
int cursor_from_overlay_pos = 0; |
10663 |
int pt_old = PT - delta; |
int pt_old = PT - delta; |
10664 |
|
|
10665 |
/* 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. |
10685 |
string_start = NULL; |
string_start = NULL; |
10686 |
x += glyph->pixel_width; |
x += glyph->pixel_width; |
10687 |
++glyph; |
++glyph; |
10688 |
|
if (cursor_from_overlay_pos |
10689 |
|
&& last_pos > cursor_from_overlay_pos) |
10690 |
|
{ |
10691 |
|
cursor_from_overlay_pos = 0; |
10692 |
|
cursor = 0; |
10693 |
|
} |
10694 |
} |
} |
10695 |
else |
else |
10696 |
{ |
{ |
10700 |
/* Skip all glyphs from string. */ |
/* Skip all glyphs from string. */ |
10701 |
do |
do |
10702 |
{ |
{ |
10703 |
|
int pos; |
10704 |
if ((cursor == NULL || glyph > cursor) |
if ((cursor == NULL || glyph > cursor) |
10705 |
&& !NILP (Fget_char_property (make_number ((glyph)->charpos), |
&& !NILP (Fget_char_property (make_number ((glyph)->charpos), |
10706 |
Qcursor, (glyph)->object))) |
Qcursor, (glyph)->object)) |
10707 |
|
&& (pos = string_buffer_position (w, glyph->object, |
10708 |
|
string_before_pos), |
10709 |
|
(pos == 0 /* From overlay */ |
10710 |
|
|| pos == pt_old))) |
10711 |
{ |
{ |
10712 |
|
/* Estimate overlay buffer position from the buffer |
10713 |
|
positions of the glyphs before and after the overlay. |
10714 |
|
Add 1 to last_pos so that if point corresponds to the |
10715 |
|
glyph right after the overlay, we still use a 'cursor' |
10716 |
|
property found in that overlay. */ |
10717 |
|
cursor_from_overlay_pos = pos == 0 ? last_pos+1 : 0; |
10718 |
cursor = glyph; |
cursor = glyph; |
10719 |
cursor_x = x; |
cursor_x = x; |
10720 |
} |
} |
15794 |
|
|
15795 |
|
|
15796 |
DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, |
DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, |
15797 |
0, 3, 0, |
0, 4, 0, |
15798 |
doc: /* Return the mode-line of selected window as a string. |
doc: /* Return the mode-line of selected window as a string. |
15799 |
First optional arg FORMAT specifies a different format string (see |
First optional arg FORMAT specifies a different format string (see |
15800 |
`mode-line-format' for details) to use. If FORMAT is t, return |
`mode-line-format' for details) to use. If FORMAT is t, return |
15801 |
the buffer's header-line. Second optional arg WINDOW specifies a |
the buffer's header-line. Second optional arg WINDOW specifies a |
15802 |
different window to use as the context for the formatting. |
different window to use as the context for the formatting. |
15803 |
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. |
15804 |
(format, window, no_props) |
Fourth optional arg BUFFER specifies which buffer to use. */) |
15805 |
Lisp_Object format, window, no_props; |
(format, window, no_props, buffer) |
15806 |
|
Lisp_Object format, window, no_props, buffer; |
15807 |
{ |
{ |
15808 |
struct it it; |
struct it it; |
15809 |
int len; |
int len; |
15815 |
window = selected_window; |
window = selected_window; |
15816 |
CHECK_WINDOW (window); |
CHECK_WINDOW (window); |
15817 |
w = XWINDOW (window); |
w = XWINDOW (window); |
|
CHECK_BUFFER (w->buffer); |
|
15818 |
|
|
15819 |
if (XBUFFER (w->buffer) != current_buffer) |
if (NILP (buffer)) |
15820 |
|
buffer = w->buffer; |
15821 |
|
|
15822 |
|
CHECK_BUFFER (buffer); |
15823 |
|
|
15824 |
|
if (XBUFFER (buffer) != current_buffer) |
15825 |
{ |
{ |
15826 |
old_buffer = current_buffer; |
old_buffer = current_buffer; |
15827 |
set_buffer_internal_1 (XBUFFER (w->buffer)); |
set_buffer_internal_1 (XBUFFER (buffer)); |
15828 |
} |
} |
15829 |
|
|
15830 |
if (NILP (format) || EQ (format, Qt)) |
if (NILP (format) || EQ (format, Qt)) |