aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-04-25 19:55:59 +0300
committerEli Zaretskii2010-04-25 19:55:59 +0300
commitf538fcec9abe33859fe4b7d84ea1d5a07d476469 (patch)
tree15c95e2525af419092597b7ae95a5c459bd54099 /src
parentadf4f59cc8df4d3a927e55743dea04725c3fecf0 (diff)
downloademacs-f538fcec9abe33859fe4b7d84ea1d5a07d476469.tar.gz
emacs-f538fcec9abe33859fe4b7d84ea1d5a07d476469.zip
Move code that bidi-iterates out of display property to a separate function.
xdisp.c (iterate_out_of_display_property): New function, body from pop_it. (pop_it): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog2
-rw-r--r--src/xdisp.c47
2 files changed, 30 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8b1c81261cc..58fdad2d1d2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,8 @@
2 2
3 * xdisp.c (display_line): Fix crash with bidi display on the last 3 * xdisp.c (display_line): Fix crash with bidi display on the last
4 empty line. (Bug#6030) 4 empty line. (Bug#6030)
5 (iterate_out_of_display_property): New function, body from pop_it.
6 (pop_it): Use it.
5 7
62010-04-24 Eli Zaretskii <eliz@gnu.org> 82010-04-24 Eli Zaretskii <eliz@gnu.org>
7 9
diff --git a/src/xdisp.c b/src/xdisp.c
index 3282c42f2a7..4834b61a626 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -5259,6 +5259,33 @@ push_it (it)
5259 ++it->sp; 5259 ++it->sp;
5260} 5260}
5261 5261
5262static void
5263iterate_out_of_display_property (it)
5264 struct it *it;
5265{
5266 /* Maybe initialize paragraph direction. If we are at the beginning
5267 of a new paragraph, next_element_from_buffer may not have a
5268 chance to do that. */
5269 if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
5270 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
5271 /* prev_stop can be zero, so check against BEGV as well. */
5272 while (it->bidi_it.charpos >= BEGV
5273 && it->prev_stop <= it->bidi_it.charpos
5274 && it->bidi_it.charpos < CHARPOS (it->position))
5275 bidi_get_next_char_visually (&it->bidi_it);
5276 /* Record the stop_pos we just crossed, for when we cross it
5277 back, maybe. */
5278 if (it->bidi_it.charpos > CHARPOS (it->position))
5279 it->prev_stop = CHARPOS (it->position);
5280 /* If we ended up not where pop_it put us, resync IT's
5281 positional members with the bidi iterator. */
5282 if (it->bidi_it.charpos != CHARPOS (it->position))
5283 {
5284 SET_TEXT_POS (it->position,
5285 it->bidi_it.charpos, it->bidi_it.bytepos);
5286 it->current.pos = it->position;
5287 }
5288}
5262 5289
5263/* Restore IT's settings from IT->stack. Called, for example, when no 5290/* Restore IT's settings from IT->stack. Called, for example, when no
5264 more overlay strings must be processed, and we return to delivering 5291 more overlay strings must be processed, and we return to delivering
@@ -5309,25 +5336,7 @@ pop_it (it)
5309 determine the paragraph base direction if the overlay we 5336 determine the paragraph base direction if the overlay we
5310 just processed is at the beginning of a new 5337 just processed is at the beginning of a new
5311 paragraph. */ 5338 paragraph. */
5312 if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV) 5339 iterate_out_of_display_property (it);
5313 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it);
5314 /* prev_stop can be zero, so check against BEGV as well. */
5315 while (it->bidi_it.charpos >= BEGV
5316 && it->prev_stop <= it->bidi_it.charpos
5317 && it->bidi_it.charpos < CHARPOS (it->position))
5318 bidi_get_next_char_visually (&it->bidi_it);
5319 /* Record the stop_pos we just crossed, for when we cross it
5320 back, maybe. */
5321 if (it->bidi_it.charpos > CHARPOS (it->position))
5322 it->prev_stop = CHARPOS (it->position);
5323 /* If we ended up not where pop_it put us, resync IT's
5324 positional members with the bidi iterator. */
5325 if (it->bidi_it.charpos != CHARPOS (it->position))
5326 {
5327 SET_TEXT_POS (it->position,
5328 it->bidi_it.charpos, it->bidi_it.bytepos);
5329 it->current.pos = it->position;
5330 }
5331 } 5340 }
5332 break; 5341 break;
5333 case GET_FROM_STRING: 5342 case GET_FROM_STRING: