comparison src/xdisp.c @ 108116:8cf84fb217cc

merge trunk
author Kenichi Handa <handa@etlken>
date Mon, 26 Apr 2010 10:22:02 +0900
parents cfcf7c495ca4
children e61225c9e186
comparison
equal deleted inserted replaced
108115:cd095471cdae 108116:8cf84fb217cc
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;
17967 row->start.pos.bytepos = row_end.pos.bytepos; 17976 row->start.pos.bytepos = row_end.pos.bytepos;
17968 } 17977 }
17969 } 17978 }
17970 else if (row->used[TEXT_AREA] && max_pos) 17979 else if (row->used[TEXT_AREA] && max_pos)
17971 { 17980 {
17972 SET_TEXT_POS (tpos, max_pos + 1, CHAR_TO_BYTE (max_pos + 1)); 17981 SET_TEXT_POS (tpos, max_pos, CHAR_TO_BYTE (max_pos));
17982 save_it = *it;
17983 it->bidi_p = 0;
17984 reseat (it, tpos, 0);
17985 if (!get_next_display_element (it))
17986 abort (); /* row at ZV was already handled above */
17987 set_iterator_to_next (it, 1);
17973 row_end = it->current; 17988 row_end = it->current;
17974 row_end.pos = tpos;
17975 /* If the character at max_pos+1 is a newline, skip that as 17989 /* If the character at max_pos+1 is a newline, skip that as
17976 well. Note that this may skip some invisible text. */ 17990 well. Note that this may skip some invisible text. */
17977 if (FETCH_CHAR (tpos.bytepos) == '\n' 17991 if (get_next_display_element (it)
17978 || (FETCH_CHAR (tpos.bytepos) == '\r' && it->selective)) 17992 && ITERATOR_AT_END_OF_LINE_P (it))
17979 { 17993 {
17980 save_it = *it;
17981 it->bidi_p = 0;
17982 reseat_1 (it, tpos, 0);
17983 set_iterator_to_next (it, 1); 17994 set_iterator_to_next (it, 1);
17984 /* Record the position after the newline of a continued 17995 /* Record the position after the newline of a continued
17985 row. We will need that to set ROW->end of the last 17996 row. We will need that to set ROW->end of the last
17986 row produced for a continued line. */ 17997 row produced for a continued line. */
17987 if (row->continued_p) 17998 if (row->continued_p)
17992 else 18003 else
17993 { 18004 {
17994 row_end = it->current; 18005 row_end = it->current;
17995 save_it.eol_pos.charpos = save_it.eol_pos.bytepos = 0; 18006 save_it.eol_pos.charpos = save_it.eol_pos.bytepos = 0;
17996 } 18007 }
17997 *it = save_it;
17998 } 18008 }
17999 else if (!row->continued_p 18009 else if (!row->continued_p
18000 && MATRIX_ROW_CONTINUATION_LINE_P (row) 18010 && MATRIX_ROW_CONTINUATION_LINE_P (row)
18001 && it->eol_pos.charpos > 0) 18011 && it->eol_pos.charpos > 0)
18002 { 18012 {
18006 displays the character with the largest buffer 18016 displays the character with the largest buffer
18007 position. */ 18017 position. */
18008 row_end.pos = it->eol_pos; 18018 row_end.pos = it->eol_pos;
18009 it->eol_pos.charpos = it->eol_pos.bytepos = 0; 18019 it->eol_pos.charpos = it->eol_pos.bytepos = 0;
18010 } 18020 }
18021 *it = save_it;
18011 row->end = row_end; 18022 row->end = row_end;
18012 } 18023 }
18013 } 18024 }
18014 18025
18015 /* Record whether this row ends inside an ellipsis. */ 18026 /* Record whether this row ends inside an ellipsis. */