comparison src/xdisp.c @ 108112:a9a653a56eef

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.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 25 Apr 2010 19:55:59 +0300
parents 69bfc9e4ceb6
children cfcf7c495ca4 65bda6b7d8b9
comparison
equal deleted inserted replaced
108111:69bfc9e4ceb6 108112:a9a653a56eef
5257 p->display_ellipsis_p = 0; 5257 p->display_ellipsis_p = 0;
5258 p->line_wrap = it->line_wrap; 5258 p->line_wrap = it->line_wrap;
5259 ++it->sp; 5259 ++it->sp;
5260 } 5260 }
5261 5261
5262 static void
5263 iterate_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
5265 display elements from a buffer, or when the end of a string from a 5292 display elements from a buffer, or when the end of a string from a
5266 `display' property is reached and we return to delivering display 5293 `display' property is reached and we return to delivering display
5307 because the internal coherency of the bidi iterator state 5334 because the internal coherency of the bidi iterator state
5308 can not be preserved across such jumps.) We also must 5335 can not be preserved across such jumps.) We also must
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:
5334 it->object = it->string; 5343 it->object = it->string;
5335 break; 5344 break;