Mercurial > emacs
changeset 71337:7128a9839095
(init_from_display_pos): Don't set it->method and
overlay_string_index after pop_it. Add asserts.
(handle_stop): Look for overlay strings around a display string,
image, or composition. Handle properties on those strings.
(next_overlay_string): Don't set string, pos or method after pop_it.
(get_overlay_strings_1): Split from get_overlay_strings; don't
modify it if no overlay strings are found.
(get_overlay_strings): Use get_overlay_strings_1. Always set
it->string and it->method.
(push_it): Push it->image_id and it->method. Push it->object
instead of it->string if method is GET_FROM_IMAGE.
(pop_it): Pop it->image_id and it->method. Ppo it->object
instead of it->string if method is GET_FROM_IMAGE.
Reset it->current.string_pos if popped it->string is nil.
(reseat_1): Remove comment dated 19 May 2003. It expressed doubt
whether a given change was correct; but the change is correct.
Clear it->string_from_display_prop_p.
(set_iterator_to_next): Rely on it->method and it->image_id from
iterator stack, instead of setting them explicitly after pop_it.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Tue, 13 Jun 2006 22:45:00 +0000 |
parents | 6844a4a9691c |
children | cb9b414fad75 |
files | src/xdisp.c |
diffstat | 1 files changed, 62 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xdisp.c Tue Jun 13 22:44:44 2006 +0000 +++ b/src/xdisp.c Tue Jun 13 22:45:00 2006 +0000 @@ -916,6 +916,7 @@ 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)); @@ -2909,8 +2910,8 @@ 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; } @@ -3021,7 +3022,18 @@ 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; } @@ -4543,13 +4555,13 @@ 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 @@ -4805,7 +4817,7 @@ 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; { @@ -4827,12 +4839,13 @@ /* 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 @@ -4844,13 +4857,22 @@ it->end_charpos = SCHARS (it->string); it->multibyte_p = STRING_MULTIBYTE (it->string); it->method = GET_FROM_STRING; - } - else - { - it->string = Qnil; - it->current.overlay_string_index = -1; - it->method = GET_FROM_BUFFER; - } + return 1; + } + + 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); @@ -4875,13 +4897,18 @@ { 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; @@ -4914,8 +4941,18 @@ 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; @@ -5233,15 +5270,10 @@ 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) @@ -5809,9 +5841,8 @@ && 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; @@ -5823,13 +5854,8 @@ 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: