aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2011-07-02 13:05:14 +0300
committerEli Zaretskii2011-07-02 13:05:14 +0300
commita2eaa31ddf8dabc71436dcb120ad7970a40045a4 (patch)
treedf11fc0eb04a1bf29f045efb190956a142b4269a /src
parentf3014ef5b24ac42ec714b48148b7b604b47f7468 (diff)
downloademacs-a2eaa31ddf8dabc71436dcb120ad7970a40045a4.tar.gz
emacs-a2eaa31ddf8dabc71436dcb120ad7970a40045a4.zip
Fix the use case of popping from display property.
src/dispextern.h (struct iterator_stack_entry, struct it): New member from_disp_prop_p. src/xdisp.c (push_it, pop_it): Save and restore from_disp_prop_p. (handle_single_display_spec, push_display_prop): Set the from_disp_prop_p flag. (get_overlay_strings_1): Reset the from_disp_prop_p flag. (pop_it): Call iterate_out_of_display_property only if we are popping after iteration over a string that came from a display property. Fix a typo in popping stretch info. Add an assertion for verifying that the iterator position is in sync with the bidi iterator. (handle_single_display_spec, get_overlay_strings_1) (push_display_prop): Fix initialization of paragraph direction for string when that of the parent object is not yet determined.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog18
-rw-r--r--src/dispextern.h5
-rw-r--r--src/xdisp.c52
3 files changed, 60 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8cb94b3ff22..c2da733feb1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12011-07-02 Eli Zaretskii <eliz@gnu.org>
2
3 * dispextern.h (struct iterator_stack_entry, struct it): New
4 member from_disp_prop_p.
5
6 * xdisp.c (push_it, pop_it): Save and restore from_disp_prop_p.
7 (handle_single_display_spec, push_display_prop): Set the
8 from_disp_prop_p flag.
9 (get_overlay_strings_1): Reset the from_disp_prop_p flag.
10 (pop_it): Call iterate_out_of_display_property only if we are
11 popping after iteration over a string that came from a display
12 property. Fix a typo in popping stretch info. Add an assertion
13 for verifying that the iterator position is in sync with the bidi
14 iterator.
15 (handle_single_display_spec, get_overlay_strings_1)
16 (push_display_prop): Fix initialization of paragraph direction for
17 string when that of the parent object is not yet determined.
18
12011-07-01 Eli Zaretskii <eliz@gnu.org> 192011-07-01 Eli Zaretskii <eliz@gnu.org>
2 20
3 * dispextern.h (struct bidi_string_data): New member `unibyte'. 21 * dispextern.h (struct bidi_string_data): New member `unibyte'.
diff --git a/src/dispextern.h b/src/dispextern.h
index 9586edab63b..997ef6df088 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2139,6 +2139,10 @@ struct it
2139 Don't handle some `display' properties in these strings. */ 2139 Don't handle some `display' properties in these strings. */
2140 unsigned string_from_display_prop_p : 1; 2140 unsigned string_from_display_prop_p : 1;
2141 2141
2142 /* 1 means we are iterating an object that came from a value of a
2143 `display' property. */
2144 unsigned from_disp_prop_p : 1;
2145
2142 /* When METHOD == next_element_from_display_vector, 2146 /* When METHOD == next_element_from_display_vector,
2143 this is 1 if we're doing an ellipsis. Otherwise meaningless. */ 2147 this is 1 if we're doing an ellipsis. Otherwise meaningless. */
2144 unsigned ellipsis_p : 1; 2148 unsigned ellipsis_p : 1;
@@ -2258,6 +2262,7 @@ struct it
2258 unsigned display_ellipsis_p : 1; 2262 unsigned display_ellipsis_p : 1;
2259 unsigned avoid_cursor_p : 1; 2263 unsigned avoid_cursor_p : 1;
2260 unsigned bidi_p:1; 2264 unsigned bidi_p:1;
2265 unsigned from_disp_prop_p : 1;
2261 enum line_wrap_method line_wrap; 2266 enum line_wrap_method line_wrap;
2262 2267
2263 /* properties from display property that are reset by another display property. */ 2268 /* properties from display property that are reset by another display property. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 43913eb886e..7c1b2051e57 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4395,6 +4395,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4395 it->method = GET_FROM_IMAGE; 4395 it->method = GET_FROM_IMAGE;
4396 it->from_overlay = Qnil; 4396 it->from_overlay = Qnil;
4397 it->face_id = face_id; 4397 it->face_id = face_id;
4398 it->from_disp_prop_p = 1;
4398 4399
4399 /* Say that we haven't consumed the characters with 4400 /* Say that we haven't consumed the characters with
4400 `display' property yet. The call to pop_it in 4401 `display' property yet. The call to pop_it in
@@ -4467,6 +4468,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4467 when we are finished with the glyph property value. */ 4468 when we are finished with the glyph property value. */
4468 push_it (it, position); 4469 push_it (it, position);
4469 it->from_overlay = overlay; 4470 it->from_overlay = overlay;
4471 it->from_disp_prop_p = 1;
4470 4472
4471 if (NILP (location)) 4473 if (NILP (location))
4472 it->area = TEXT_AREA; 4474 it->area = TEXT_AREA;
@@ -4494,9 +4496,12 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4494 *position = start_pos; 4496 *position = start_pos;
4495 4497
4496 /* Force paragraph direction to be that of the parent 4498 /* Force paragraph direction to be that of the parent
4497 object. */ 4499 object. If the parent object's paragraph direction is
4498 it->paragraph_embedding = 4500 not yet determined, default to L2R. */
4499 (it->bidi_p ? it->bidi_it.paragraph_dir : L2R); 4501 if (it->bidi_p && it->bidi_it.paragraph_dir == R2L)
4502 it->paragraph_embedding = it->bidi_it.paragraph_dir;
4503 else
4504 it->paragraph_embedding = L2R;
4500 4505
4501 /* Set up the bidi iterator for this display string. */ 4506 /* Set up the bidi iterator for this display string. */
4502 if (it->bidi_p) 4507 if (it->bidi_p)
@@ -5144,10 +5149,14 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
5144 it->base_level_stop = 0; 5149 it->base_level_stop = 0;
5145 it->multibyte_p = STRING_MULTIBYTE (it->string); 5150 it->multibyte_p = STRING_MULTIBYTE (it->string);
5146 it->method = GET_FROM_STRING; 5151 it->method = GET_FROM_STRING;
5152 it->from_disp_prop_p = 0;
5147 5153
5148 /* Force paragraph direction to be that of the parent 5154 /* Force paragraph direction to be that of the parent
5149 buffer. */ 5155 buffer. */
5150 it->paragraph_embedding = (it->bidi_p ? it->bidi_it.paragraph_dir : L2R); 5156 if (it->bidi_p && it->bidi_it.paragraph_dir == R2L)
5157 it->paragraph_embedding = it->bidi_it.paragraph_dir;
5158 else
5159 it->paragraph_embedding = L2R;
5151 5160
5152 /* Set up the bidi iterator for this overlay string. */ 5161 /* Set up the bidi iterator for this overlay string. */
5153 if (it->bidi_p) 5162 if (it->bidi_p)
@@ -5238,6 +5247,7 @@ push_it (struct it *it, struct text_pos *position)
5238 p->line_wrap = it->line_wrap; 5247 p->line_wrap = it->line_wrap;
5239 p->bidi_p = it->bidi_p; 5248 p->bidi_p = it->bidi_p;
5240 p->paragraph_embedding = it->paragraph_embedding; 5249 p->paragraph_embedding = it->paragraph_embedding;
5250 p->from_disp_prop_p = it->from_disp_prop_p;
5241 ++it->sp; 5251 ++it->sp;
5242 5252
5243 /* Save the state of the bidi iterator as well. */ 5253 /* Save the state of the bidi iterator as well. */
@@ -5289,6 +5299,7 @@ static void
5289pop_it (struct it *it) 5299pop_it (struct it *it)
5290{ 5300{
5291 struct iterator_stack_entry *p; 5301 struct iterator_stack_entry *p;
5302 int from_display_prop = it->from_disp_prop_p;
5292 5303
5293 xassert (it->sp > 0); 5304 xassert (it->sp > 0);
5294 --it->sp; 5305 --it->sp;
@@ -5313,7 +5324,7 @@ pop_it (struct it *it)
5313 it->slice = p->u.image.slice; 5324 it->slice = p->u.image.slice;
5314 break; 5325 break;
5315 case GET_FROM_STRETCH: 5326 case GET_FROM_STRETCH:
5316 it->object = p->u.comp.object; 5327 it->object = p->u.stretch.object;
5317 break; 5328 break;
5318 case GET_FROM_BUFFER: 5329 case GET_FROM_BUFFER:
5319 it->object = it->w->buffer; 5330 it->object = it->w->buffer;
@@ -5344,6 +5355,7 @@ pop_it (struct it *it)
5344 it->line_wrap = p->line_wrap; 5355 it->line_wrap = p->line_wrap;
5345 it->bidi_p = p->bidi_p; 5356 it->bidi_p = p->bidi_p;
5346 it->paragraph_embedding = p->paragraph_embedding; 5357 it->paragraph_embedding = p->paragraph_embedding;
5358 it->from_disp_prop_p = p->from_disp_prop_p;
5347 if (it->bidi_p) 5359 if (it->bidi_p)
5348 { 5360 {
5349 bidi_pop_it (&it->bidi_it); 5361 bidi_pop_it (&it->bidi_it);
@@ -5354,8 +5366,16 @@ pop_it (struct it *it)
5354 preserved across such jumps.) We also must determine the 5366 preserved across such jumps.) We also must determine the
5355 paragraph base direction if the overlay we just processed is 5367 paragraph base direction if the overlay we just processed is
5356 at the beginning of a new paragraph. */ 5368 at the beginning of a new paragraph. */
5357 if (it->method == GET_FROM_BUFFER || it->method == GET_FROM_STRING) 5369 if (from_display_prop
5370 && (it->method == GET_FROM_BUFFER || it->method == GET_FROM_STRING))
5358 iterate_out_of_display_property (it); 5371 iterate_out_of_display_property (it);
5372
5373 xassert ((BUFFERP (it->object)
5374 && IT_CHARPOS (*it) == it->bidi_it.charpos
5375 && IT_BYTEPOS (*it) == it->bidi_it.bytepos)
5376 || (STRINGP (it->object)
5377 && IT_STRING_CHARPOS (*it) == it->bidi_it.charpos
5378 && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos));
5359 } 5379 }
5360} 5380}
5361 5381
@@ -11062,11 +11082,11 @@ redisplay_tool_bar (struct frame *f)
11062 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 11082 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
11063 /* FIXME: This should be controlled by a user option. But it 11083 /* FIXME: This should be controlled by a user option. But it
11064 doesn't make sense to have an R2L tool bar if the menu bar cannot 11084 doesn't make sense to have an R2L tool bar if the menu bar cannot
11065 be drawn also R2L, and making the menu bar R2L is tricky due to 11085 be drawn also R2L, and making the menu bar R2L is tricky due
11066 unibyte strings it uses and toolkit-specific code that implements 11086 toolkit-specific code that implements it. If an R2L tool bar is
11067 it. If an R2L tool bar is ever supported, display_tool_bar_line 11087 ever supported, display_tool_bar_line should also be augmented to
11068 should also be augmented to call unproduce_glyphs like 11088 call unproduce_glyphs like display_line and display_string
11069 display_line and display_string do. */ 11089 do. */
11070 it.paragraph_embedding = L2R; 11090 it.paragraph_embedding = L2R;
11071 11091
11072 if (f->n_tool_bar_rows == 0) 11092 if (f->n_tool_bar_rows == 0)
@@ -17764,10 +17784,14 @@ push_display_prop (struct it *it, Lisp_Object prop)
17764 it->prev_stop = 0; 17784 it->prev_stop = 0;
17765 it->base_level_stop = 0; 17785 it->base_level_stop = 0;
17766 it->string_from_display_prop_p = 1; 17786 it->string_from_display_prop_p = 1;
17787 it->from_disp_prop_p = 1;
17767 17788
17768 /* Force paragraph direction to be that of the parent 17789 /* Force paragraph direction to be that of the parent
17769 buffer. */ 17790 buffer. */
17770 it->paragraph_embedding = (it->bidi_p ? it->bidi_it.paragraph_dir : L2R); 17791 if (it->bidi_p && it->bidi_it.paragraph_dir == R2L)
17792 it->paragraph_embedding = it->bidi_it.paragraph_dir;
17793 else
17794 it->paragraph_embedding = L2R;
17771 17795
17772 /* Set up the bidi iterator for this display string. */ 17796 /* Set up the bidi iterator for this display string. */
17773 if (it->bidi_p) 17797 if (it->bidi_p)
@@ -18969,9 +18993,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
18969 18993
18970 /* FIXME: This should be controlled by a user option. But 18994 /* FIXME: This should be controlled by a user option. But
18971 supporting such an option is not trivial, since the mode line is 18995 supporting such an option is not trivial, since the mode line is
18972 made up of many separate strings, most of which are normally 18996 made up of many separate strings. */
18973 unibyte, and unibyte strings currently don't get reordered for
18974 display. */
18975 it.paragraph_embedding = L2R; 18997 it.paragraph_embedding = L2R;
18976 18998
18977 record_unwind_protect (unwind_format_mode_line, 18999 record_unwind_protect (unwind_format_mode_line,