static void compute_line_metrics P_ ((struct it *));
static void run_redisplay_end_trigger_hook P_ ((struct it *));
static int get_overlay_strings P_ ((struct it *, int));
+static int get_overlay_strings_1 P_ ((struct it *, int, int));
static void next_overlay_string P_ ((struct it *));
static void reseat P_ ((struct it *, struct text_pos, int));
static void reseat_1 P_ ((struct it *, struct text_pos, int));
also ``processed'' overlay strings at ZV. */
while (it->sp)
pop_it (it);
- it->current.overlay_string_index = -1;
- it->method = GET_FROM_BUFFER;
+ xassert (it->current.overlay_string_index == -1);
+ xassert (it->method == GET_FROM_BUFFER);
if (CHARPOS (pos->pos) == ZV)
it->overlay_strings_at_end_processed_p = 1;
}
if (handled == HANDLED_RECOMPUTE_PROPS)
break;
else if (handled == HANDLED_RETURN)
- return;
+ {
+ /* We still want to show before and after strings from
+ overlays even if the actual buffer text is replaced. */
+ if (!handle_overlay_change_p || it->sp > 1)
+ return;
+ if (!get_overlay_strings_1 (it, 0, 0))
+ return;
+ it->string_from_display_prop_p = 0;
+ handle_overlay_change_p = 0;
+ handled = HANDLED_RECOMPUTE_PROPS;
+ break;
+ }
else if (handled == HANDLED_OVERLAY_STRING_CONSUMED)
handle_overlay_change_p = 0;
}
int display_ellipsis_p = it->stack[it->sp - 1].display_ellipsis_p;
pop_it (it);
- xassert (it->stop_charpos >= BEGV
- && it->stop_charpos <= it->end_charpos);
- it->string = Qnil;
+ xassert (it->sp > 0
+ || (NILP (it->string)
+ && it->method == GET_FROM_BUFFER
+ && it->stop_charpos >= BEGV
+ && it->stop_charpos <= it->end_charpos));
it->current.overlay_string_index = -1;
- SET_TEXT_POS (it->current.string_pos, -1, -1);
it->n_overlay_strings = 0;
- it->method = GET_FROM_BUFFER;
/* If we're at the end of the buffer, record that we have
processed the overlay strings there already, so that
least one overlay string was found. */
static int
-get_overlay_strings (it, charpos)
+get_overlay_strings_1 (it, charpos, compute_stop_p)
struct it *it;
int charpos;
{
/* Make sure we know settings in current_buffer, so that we can
restore meaningful values when we're done with the overlay
strings. */
- compute_stop_pos (it);
+ if (compute_stop_p)
+ compute_stop_pos (it);
xassert (it->face_id >= 0);
/* Save IT's settings. They are restored after all overlay
strings have been processed. */
- xassert (it->sp == 0);
+ xassert (!compute_stop_p || it->sp == 0);
push_it (it);
/* Set up IT to deliver display elements from the first overlay
it->end_charpos = SCHARS (it->string);
it->multibyte_p = STRING_MULTIBYTE (it->string);
it->method = GET_FROM_STRING;
+ return 1;
}
- else
- {
- it->string = Qnil;
- it->current.overlay_string_index = -1;
- it->method = GET_FROM_BUFFER;
- }
+
+ it->current.overlay_string_index = -1;
+ return 0;
+}
+
+static int
+get_overlay_strings (it, charpos)
+ struct it *it;
+ int charpos;
+{
+ it->string = Qnil;
+ it->method = GET_FROM_BUFFER;
+
+ (void) get_overlay_strings_1 (it, charpos, 1);
CHECK_IT (it);
{
struct iterator_stack_entry *p;
- xassert (it->sp < 2);
+ xassert (it->sp < IT_STACK_SIZE);
p = it->stack + it->sp;
p->stop_charpos = it->stop_charpos;
xassert (it->face_id >= 0);
p->face_id = it->face_id;
- p->string = it->string;
+ p->image_id = it->image_id;
+ p->method = it->method;
+ if (it->method == GET_FROM_IMAGE)
+ p->string = it->object;
+ else
+ p->string = it->string;
p->pos = it->current;
p->end_charpos = it->end_charpos;
p->string_nchars = it->string_nchars;
p = it->stack + it->sp;
it->stop_charpos = p->stop_charpos;
it->face_id = p->face_id;
- it->string = p->string;
+ it->method = p->method;
+ it->image_id = p->image_id;
it->current = p->pos;
+ if (it->method == GET_FROM_IMAGE)
+ {
+ it->object = it->string;
+ it->string = Qnil;
+ }
+ else
+ it->string = p->string;
+ if (NILP (it->string))
+ SET_TEXT_POS (it->current.string_pos, -1, -1);
it->end_charpos = p->end_charpos;
it->string_nchars = p->string_nchars;
it->area = p->area;
IT_STRING_BYTEPOS (*it) = -1;
it->string = Qnil;
it->method = GET_FROM_BUFFER;
- /* RMS: I added this to fix a bug in move_it_vertically_backward
- where it->area continued to relate to the starting point
- for the backward motion. Bug report from
- Nick Roberts <nick@nick.uklinux.net> on 19 May 2003.
- However, I am not sure whether reseat still does the right thing
- in general after this change. */
it->area = TEXT_AREA;
it->multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
it->sp = 0;
+ it->string_from_display_prop_p = 0;
it->face_before_selective_p = 0;
if (set_stop_p)
&& it->sp > 0)
{
pop_it (it);
- if (STRINGP (it->string))
+ if (it->method == GET_FROM_STRING)
goto consider_string_end;
- it->method = GET_FROM_BUFFER;
}
}
break;
if the `display' property takes up the whole string. */
xassert (it->sp > 0);
pop_it (it);
- it->image_id = 0;
- if (STRINGP (it->string))
- {
- it->method = GET_FROM_STRING;
- goto consider_string_end;
- }
- it->method = GET_FROM_BUFFER;
+ if (it->method == GET_FROM_STRING)
+ goto consider_string_end;
break;
default: