diff options
| author | Joakim Verona | 2011-08-13 16:20:57 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-08-13 16:20:57 +0200 |
| commit | 8aa09b5b6afe5210ed341754f4addd663dc77151 (patch) | |
| tree | d9df2f0bf62e9ccf073fdbb953be0fb749a85d99 /src | |
| parent | 3637e3bf04cc1e54850a877c6535a075caad7e5e (diff) | |
| parent | 08fff70c6eab76f935d6827e3fd030ec40457f1d (diff) | |
| download | emacs-8aa09b5b6afe5210ed341754f4addd663dc77151.tar.gz emacs-8aa09b5b6afe5210ed341754f4addd663dc77151.zip | |
usptream + doc
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/xdisp.c | 43 |
2 files changed, 39 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index af9586037d7..5c65159a841 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2011-08-12 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (iterate_out_of_display_property): xassert that | ||
| 4 | IT->position is set to within IT->object's boundaries. Break from | ||
| 5 | the loop as soon as EOB is reached; avoids infloops in redisplay | ||
| 6 | when IT->position is set up wrongly due to some bug. Set | ||
| 7 | IT->current to match the bidi iterator unconditionally. | ||
| 8 | (push_display_prop): Allow GET_FROM_STRING as IT->method on | ||
| 9 | entry. Force push_it to save on the stack the current | ||
| 10 | buffer/string position, to be restored by pop_it. Fix flags in | ||
| 11 | the iterator structure wrt the object coming from a display | ||
| 12 | property, as `line-prefix' and `wrap-prefix' are not ``replacing'' | ||
| 13 | properties. (Bug#9284) | ||
| 14 | |||
| 1 | 2011-08-09 Andreas Schwab <schwab@linux-m68k.org> | 15 | 2011-08-09 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 16 | ||
| 3 | * fontset.c (fontset_get_font_group): Add proper type checks. | 17 | * fontset.c (fontset_get_font_group): Add proper type checks. |
diff --git a/src/xdisp.c b/src/xdisp.c index b58c8da8203..ea5d1ae34c8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5356,6 +5356,8 @@ iterate_out_of_display_property (struct it *it) | |||
| 5356 | EMACS_INT eob = (buffer_p ? ZV : it->end_charpos); | 5356 | EMACS_INT eob = (buffer_p ? ZV : it->end_charpos); |
| 5357 | EMACS_INT bob = (buffer_p ? BEGV : 0); | 5357 | EMACS_INT bob = (buffer_p ? BEGV : 0); |
| 5358 | 5358 | ||
| 5359 | xassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob); | ||
| 5360 | |||
| 5359 | /* Maybe initialize paragraph direction. If we are at the beginning | 5361 | /* Maybe initialize paragraph direction. If we are at the beginning |
| 5360 | of a new paragraph, next_element_from_buffer may not have a | 5362 | of a new paragraph, next_element_from_buffer may not have a |
| 5361 | chance to do that. */ | 5363 | chance to do that. */ |
| @@ -5364,7 +5366,8 @@ iterate_out_of_display_property (struct it *it) | |||
| 5364 | /* prev_stop can be zero, so check against BEGV as well. */ | 5366 | /* prev_stop can be zero, so check against BEGV as well. */ |
| 5365 | while (it->bidi_it.charpos >= bob | 5367 | while (it->bidi_it.charpos >= bob |
| 5366 | && it->prev_stop <= it->bidi_it.charpos | 5368 | && it->prev_stop <= it->bidi_it.charpos |
| 5367 | && it->bidi_it.charpos < CHARPOS (it->position)) | 5369 | && it->bidi_it.charpos < CHARPOS (it->position) |
| 5370 | && it->bidi_it.charpos < eob) | ||
| 5368 | bidi_move_to_visually_next (&it->bidi_it); | 5371 | bidi_move_to_visually_next (&it->bidi_it); |
| 5369 | /* Record the stop_pos we just crossed, for when we cross it | 5372 | /* Record the stop_pos we just crossed, for when we cross it |
| 5370 | back, maybe. */ | 5373 | back, maybe. */ |
| @@ -5373,14 +5376,11 @@ iterate_out_of_display_property (struct it *it) | |||
| 5373 | /* If we ended up not where pop_it put us, resync IT's | 5376 | /* If we ended up not where pop_it put us, resync IT's |
| 5374 | positional members with the bidi iterator. */ | 5377 | positional members with the bidi iterator. */ |
| 5375 | if (it->bidi_it.charpos != CHARPOS (it->position)) | 5378 | if (it->bidi_it.charpos != CHARPOS (it->position)) |
| 5376 | { | 5379 | SET_TEXT_POS (it->position, it->bidi_it.charpos, it->bidi_it.bytepos); |
| 5377 | SET_TEXT_POS (it->position, | 5380 | if (buffer_p) |
| 5378 | it->bidi_it.charpos, it->bidi_it.bytepos); | 5381 | it->current.pos = it->position; |
| 5379 | if (buffer_p) | 5382 | else |
| 5380 | it->current.pos = it->position; | 5383 | it->current.string_pos = it->position; |
| 5381 | else | ||
| 5382 | it->current.string_pos = it->position; | ||
| 5383 | } | ||
| 5384 | } | 5384 | } |
| 5385 | 5385 | ||
| 5386 | /* Restore IT's settings from IT->stack. Called, for example, when no | 5386 | /* Restore IT's settings from IT->stack. Called, for example, when no |
| @@ -18161,16 +18161,25 @@ cursor_row_p (struct glyph_row *row) | |||
| 18161 | 18161 | ||
| 18162 | 18162 | ||
| 18163 | 18163 | ||
| 18164 | /* Push the display property PROP so that it will be rendered at the | 18164 | /* Push the property PROP so that it will be rendered at the current |
| 18165 | current position in IT. Return 1 if PROP was successfully pushed, | 18165 | position in IT. Return 1 if PROP was successfully pushed, 0 |
| 18166 | 0 otherwise. */ | 18166 | otherwise. Called from handle_line_prefix to handle the |
| 18167 | `line-prefix' and `wrap-prefix' properties. */ | ||
| 18167 | 18168 | ||
| 18168 | static int | 18169 | static int |
| 18169 | push_display_prop (struct it *it, Lisp_Object prop) | 18170 | push_display_prop (struct it *it, Lisp_Object prop) |
| 18170 | { | 18171 | { |
| 18171 | xassert (it->method == GET_FROM_BUFFER); | 18172 | struct text_pos pos = |
| 18173 | (it->method == GET_FROM_STRING) ? it->current.string_pos : it->current.pos; | ||
| 18172 | 18174 | ||
| 18173 | push_it (it, NULL); | 18175 | xassert (it->method == GET_FROM_BUFFER |
| 18176 | || it->method == GET_FROM_STRING); | ||
| 18177 | |||
| 18178 | /* We need to save the current buffer/string position, so it will be | ||
| 18179 | restored by pop_it, because iterate_out_of_display_property | ||
| 18180 | depends on that being set correctly, but some situations leave | ||
| 18181 | it->position not yet set when this function is called. */ | ||
| 18182 | push_it (it, &pos); | ||
| 18174 | 18183 | ||
| 18175 | if (STRINGP (prop)) | 18184 | if (STRINGP (prop)) |
| 18176 | { | 18185 | { |
| @@ -18189,11 +18198,9 @@ push_display_prop (struct it *it, Lisp_Object prop) | |||
| 18189 | it->stop_charpos = 0; | 18198 | it->stop_charpos = 0; |
| 18190 | it->prev_stop = 0; | 18199 | it->prev_stop = 0; |
| 18191 | it->base_level_stop = 0; | 18200 | it->base_level_stop = 0; |
| 18192 | it->string_from_display_prop_p = 1; | ||
| 18193 | it->from_disp_prop_p = 1; | ||
| 18194 | 18201 | ||
| 18195 | /* Force paragraph direction to be that of the parent | 18202 | /* Force paragraph direction to be that of the parent |
| 18196 | buffer. */ | 18203 | buffer/string. */ |
| 18197 | if (it->bidi_p && it->bidi_it.paragraph_dir == R2L) | 18204 | if (it->bidi_p && it->bidi_it.paragraph_dir == R2L) |
| 18198 | it->paragraph_embedding = it->bidi_it.paragraph_dir; | 18205 | it->paragraph_embedding = it->bidi_it.paragraph_dir; |
| 18199 | else | 18206 | else |
| @@ -18206,7 +18213,7 @@ push_display_prop (struct it *it, Lisp_Object prop) | |||
| 18206 | it->bidi_it.string.s = NULL; | 18213 | it->bidi_it.string.s = NULL; |
| 18207 | it->bidi_it.string.schars = it->end_charpos; | 18214 | it->bidi_it.string.schars = it->end_charpos; |
| 18208 | it->bidi_it.string.bufpos = IT_CHARPOS (*it); | 18215 | it->bidi_it.string.bufpos = IT_CHARPOS (*it); |
| 18209 | it->bidi_it.string.from_disp_str = 1; | 18216 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 18210 | it->bidi_it.string.unibyte = !it->multibyte_p; | 18217 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 18211 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 18218 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 18212 | } | 18219 | } |