aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-10-24 19:00:42 +0000
committerChong Yidong2008-10-24 19:00:42 +0000
commite919f0b153c2815df754ad18e16e9ef4f58c0cd8 (patch)
tree4ad63489f6493193c79caa1b5f96ac72bef950a9
parent34fcddd0163fb74f411b7a2d74f0a4df4e928ef8 (diff)
downloademacs-e919f0b153c2815df754ad18e16e9ef4f58c0cd8.tar.gz
emacs-e919f0b153c2815df754ad18e16e9ef4f58c0cd8.zip
(handle_single_display_spec, handle_display_prop): Undo
2005-05-16 change. (handle_stop): Pop iterator if it's loaded with an empty string. (get_overlay_strings_1): Don't save iterator if it's loaded with an empty string (bug#1201).
-rw-r--r--src/xdisp.c58
1 files changed, 23 insertions, 35 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index f8fce43ad34..b7c05f9eed4 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2999,25 +2999,6 @@ init_from_display_pos (it, w, pos)
2999 it->method = GET_FROM_STRING; 2999 it->method = GET_FROM_STRING;
3000 } 3000 }
3001 3001
3002#if 0 /* This is bogus because POS not having an overlay string
3003 position does not mean it's after the string. Example: A
3004 line starting with a before-string and initialization of IT
3005 to the previous row's end position. */
3006 else if (it->current.overlay_string_index >= 0)
3007 {
3008 /* If POS says we're already after an overlay string ending at
3009 POS, make sure to pop the iterator because it will be in
3010 front of that overlay string. When POS is ZV, we've thereby
3011 also ``processed'' overlay strings at ZV. */
3012 while (it->sp)
3013 pop_it (it);
3014 xassert (it->current.overlay_string_index == -1);
3015 xassert (it->method == GET_FROM_BUFFER);
3016 if (CHARPOS (pos->pos) == ZV)
3017 it->overlay_strings_at_end_processed_p = 1;
3018 }
3019#endif /* 0 */
3020
3021 if (CHARPOS (pos->string_pos) >= 0) 3002 if (CHARPOS (pos->string_pos) >= 0)
3022 { 3003 {
3023 /* Recorded position is not in an overlay string, but in another 3004 /* Recorded position is not in an overlay string, but in another
@@ -3133,11 +3114,23 @@ handle_stop (it)
3133 { 3114 {
3134 if (it->ellipsis_p) 3115 if (it->ellipsis_p)
3135 setup_for_ellipsis (it, 0); 3116 setup_for_ellipsis (it, 0);
3117 /* When handling a display spec, we might load an
3118 empty string. In that case, discard it here. We
3119 used to discard it in handle_single_display_spec,
3120 but that causes get_overlay_strings_1, above, to
3121 ignore overlay strings that we must check. */
3122 if (STRINGP (it->string) && !SCHARS (it->string))
3123 pop_it (it);
3136 return; 3124 return;
3137 } 3125 }
3138 it->ignore_overlay_strings_at_pos_p = 1; 3126 else if (STRINGP (it->string) && !SCHARS (it->string))
3139 it->string_from_display_prop_p = 0; 3127 pop_it (it);
3140 handle_overlay_change_p = 0; 3128 else
3129 {
3130 it->ignore_overlay_strings_at_pos_p = 1;
3131 it->string_from_display_prop_p = 0;
3132 handle_overlay_change_p = 0;
3133 }
3141 handled = HANDLED_RECOMPUTE_PROPS; 3134 handled = HANDLED_RECOMPUTE_PROPS;
3142 break; 3135 break;
3143 } 3136 }
@@ -4002,11 +3995,8 @@ handle_display_prop (it)
4002 } 3995 }
4003 else 3996 else
4004 { 3997 {
4005 int ret = handle_single_display_spec (it, prop, object, overlay, 3998 if (handle_single_display_spec (it, prop, object, overlay,
4006 position, 0); 3999 position, 0))
4007 if (ret < 0) /* Replaced by "", i.e. nothing. */
4008 return HANDLED_RECOMPUTE_PROPS;
4009 if (ret)
4010 display_replaced_p = 1; 4000 display_replaced_p = 1;
4011 } 4001 }
4012 4002
@@ -4053,8 +4043,7 @@ display_prop_end (it, object, start_pos)
4053 property ends. 4043 property ends.
4054 4044
4055 Value is non-zero if something was found which replaces the display 4045 Value is non-zero if something was found which replaces the display
4056 of buffer or string text. Specifically, the value is -1 if that 4046 of buffer or string text. */
4057 "something" is "nothing". */
4058 4047
4059static int 4048static int
4060handle_single_display_spec (it, spec, object, overlay, position, 4049handle_single_display_spec (it, spec, object, overlay, position,
@@ -4379,11 +4368,6 @@ handle_single_display_spec (it, spec, object, overlay, position,
4379 4368
4380 if (STRINGP (value)) 4369 if (STRINGP (value))
4381 { 4370 {
4382 if (SCHARS (value) == 0)
4383 {
4384 pop_it (it);
4385 return -1; /* Replaced by "", i.e. nothing. */
4386 }
4387 it->string = value; 4371 it->string = value;
4388 it->multibyte_p = STRING_MULTIBYTE (it->string); 4372 it->multibyte_p = STRING_MULTIBYTE (it->string);
4389 it->current.overlay_string_index = -1; 4373 it->current.overlay_string_index = -1;
@@ -5032,7 +5016,11 @@ get_overlay_strings_1 (it, charpos, compute_stop_p)
5032 /* Save IT's settings. They are restored after all overlay 5016 /* Save IT's settings. They are restored after all overlay
5033 strings have been processed. */ 5017 strings have been processed. */
5034 xassert (!compute_stop_p || it->sp == 0); 5018 xassert (!compute_stop_p || it->sp == 0);
5035 push_it (it); 5019
5020 /* When called from handle_stop, there might be an empty display
5021 string loaded. In that case, don't bother saving it. */
5022 if (!STRINGP (it->string) || SCHARS (it->string))
5023 push_it (it);
5036 5024
5037 /* Set up IT to deliver display elements from the first overlay 5025 /* Set up IT to deliver display elements from the first overlay
5038 string. */ 5026 string. */