diff options
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 1437aafef39..a3bdcbdf4c6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -5326,6 +5326,8 @@ iterate_out_of_display_property (struct it *it) | |||
| 5326 | EMACS_INT eob = (buffer_p ? ZV : it->end_charpos); | 5326 | EMACS_INT eob = (buffer_p ? ZV : it->end_charpos); |
| 5327 | EMACS_INT bob = (buffer_p ? BEGV : 0); | 5327 | EMACS_INT bob = (buffer_p ? BEGV : 0); |
| 5328 | 5328 | ||
| 5329 | xassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob); | ||
| 5330 | |||
| 5329 | /* Maybe initialize paragraph direction. If we are at the beginning | 5331 | /* Maybe initialize paragraph direction. If we are at the beginning |
| 5330 | of a new paragraph, next_element_from_buffer may not have a | 5332 | of a new paragraph, next_element_from_buffer may not have a |
| 5331 | chance to do that. */ | 5333 | chance to do that. */ |
| @@ -5334,7 +5336,8 @@ iterate_out_of_display_property (struct it *it) | |||
| 5334 | /* prev_stop can be zero, so check against BEGV as well. */ | 5336 | /* prev_stop can be zero, so check against BEGV as well. */ |
| 5335 | while (it->bidi_it.charpos >= bob | 5337 | while (it->bidi_it.charpos >= bob |
| 5336 | && it->prev_stop <= it->bidi_it.charpos | 5338 | && it->prev_stop <= it->bidi_it.charpos |
| 5337 | && it->bidi_it.charpos < CHARPOS (it->position)) | 5339 | && it->bidi_it.charpos < CHARPOS (it->position) |
| 5340 | && it->bidi_it.charpos < eob) | ||
| 5338 | bidi_move_to_visually_next (&it->bidi_it); | 5341 | bidi_move_to_visually_next (&it->bidi_it); |
| 5339 | /* Record the stop_pos we just crossed, for when we cross it | 5342 | /* Record the stop_pos we just crossed, for when we cross it |
| 5340 | back, maybe. */ | 5343 | back, maybe. */ |
| @@ -5343,14 +5346,11 @@ iterate_out_of_display_property (struct it *it) | |||
| 5343 | /* If we ended up not where pop_it put us, resync IT's | 5346 | /* If we ended up not where pop_it put us, resync IT's |
| 5344 | positional members with the bidi iterator. */ | 5347 | positional members with the bidi iterator. */ |
| 5345 | if (it->bidi_it.charpos != CHARPOS (it->position)) | 5348 | if (it->bidi_it.charpos != CHARPOS (it->position)) |
| 5346 | { | 5349 | SET_TEXT_POS (it->position, it->bidi_it.charpos, it->bidi_it.bytepos); |
| 5347 | SET_TEXT_POS (it->position, | 5350 | if (buffer_p) |
| 5348 | it->bidi_it.charpos, it->bidi_it.bytepos); | 5351 | it->current.pos = it->position; |
| 5349 | if (buffer_p) | 5352 | else |
| 5350 | it->current.pos = it->position; | 5353 | it->current.string_pos = it->position; |
| 5351 | else | ||
| 5352 | it->current.string_pos = it->position; | ||
| 5353 | } | ||
| 5354 | } | 5354 | } |
| 5355 | 5355 | ||
| 5356 | /* Restore IT's settings from IT->stack. Called, for example, when no | 5356 | /* Restore IT's settings from IT->stack. Called, for example, when no |
| @@ -18056,16 +18056,25 @@ cursor_row_p (struct glyph_row *row) | |||
| 18056 | 18056 | ||
| 18057 | 18057 | ||
| 18058 | 18058 | ||
| 18059 | /* Push the display property PROP so that it will be rendered at the | 18059 | /* Push the property PROP so that it will be rendered at the current |
| 18060 | current position in IT. Return 1 if PROP was successfully pushed, | 18060 | position in IT. Return 1 if PROP was successfully pushed, 0 |
| 18061 | 0 otherwise. */ | 18061 | otherwise. Called from handle_line_prefix to handle the |
| 18062 | `line-prefix' and `wrap-prefix' properties. */ | ||
| 18062 | 18063 | ||
| 18063 | static int | 18064 | static int |
| 18064 | push_display_prop (struct it *it, Lisp_Object prop) | 18065 | push_display_prop (struct it *it, Lisp_Object prop) |
| 18065 | { | 18066 | { |
| 18066 | xassert (it->method == GET_FROM_BUFFER); | 18067 | struct text_pos pos = |
| 18068 | (it->method == GET_FROM_STRING) ? it->current.string_pos : it->current.pos; | ||
| 18067 | 18069 | ||
| 18068 | push_it (it, NULL); | 18070 | xassert (it->method == GET_FROM_BUFFER |
| 18071 | || it->method == GET_FROM_STRING); | ||
| 18072 | |||
| 18073 | /* We need to save the current buffer/string position, so it will be | ||
| 18074 | restored by pop_it, because iterate_out_of_display_property | ||
| 18075 | depends on that being set correctly, but some situations leave | ||
| 18076 | it->position not yet set when this function is called. */ | ||
| 18077 | push_it (it, &pos); | ||
| 18069 | 18078 | ||
| 18070 | if (STRINGP (prop)) | 18079 | if (STRINGP (prop)) |
| 18071 | { | 18080 | { |
| @@ -18084,11 +18093,9 @@ push_display_prop (struct it *it, Lisp_Object prop) | |||
| 18084 | it->stop_charpos = 0; | 18093 | it->stop_charpos = 0; |
| 18085 | it->prev_stop = 0; | 18094 | it->prev_stop = 0; |
| 18086 | it->base_level_stop = 0; | 18095 | it->base_level_stop = 0; |
| 18087 | it->string_from_display_prop_p = 1; | ||
| 18088 | it->from_disp_prop_p = 1; | ||
| 18089 | 18096 | ||
| 18090 | /* Force paragraph direction to be that of the parent | 18097 | /* Force paragraph direction to be that of the parent |
| 18091 | buffer. */ | 18098 | buffer/string. */ |
| 18092 | if (it->bidi_p && it->bidi_it.paragraph_dir == R2L) | 18099 | if (it->bidi_p && it->bidi_it.paragraph_dir == R2L) |
| 18093 | it->paragraph_embedding = it->bidi_it.paragraph_dir; | 18100 | it->paragraph_embedding = it->bidi_it.paragraph_dir; |
| 18094 | else | 18101 | else |
| @@ -18101,7 +18108,7 @@ push_display_prop (struct it *it, Lisp_Object prop) | |||
| 18101 | it->bidi_it.string.s = NULL; | 18108 | it->bidi_it.string.s = NULL; |
| 18102 | it->bidi_it.string.schars = it->end_charpos; | 18109 | it->bidi_it.string.schars = it->end_charpos; |
| 18103 | it->bidi_it.string.bufpos = IT_CHARPOS (*it); | 18110 | it->bidi_it.string.bufpos = IT_CHARPOS (*it); |
| 18104 | it->bidi_it.string.from_disp_str = 1; | 18111 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 18105 | it->bidi_it.string.unibyte = !it->multibyte_p; | 18112 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 18106 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 18113 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 18107 | } | 18114 | } |