comparison src/xdisp.c @ 107636:b5cb7368c1bc

Continue work on continuation lines. xdisp.c (set_cursor_from_row): Compare candidate cursor positions only in rows whose buffer positions occlude point. (display_line): Fix computation of row->start and row->end for empty lines. dispnew.c (row_equal_p): Compare the reversed_p attributes as well.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 20 Feb 2010 11:22:07 -0500
parents 199cad45d7ba
children 59df2de8b31d
comparison
equal deleted inserted replaced
107635:a5eeeb631d8a 107636:b5cb7368c1bc
13010 13010
13011 /* ROW could be part of a continued line, which might have other 13011 /* ROW could be part of a continued line, which might have other
13012 rows whose start and end charpos occlude point. Only set 13012 rows whose start and end charpos occlude point. Only set
13013 w->cursor if we found a better approximation to the cursor 13013 w->cursor if we found a better approximation to the cursor
13014 position than we have from previously examined rows. */ 13014 position than we have from previously examined rows. */
13015 if (w->cursor.vpos >= 0) 13015 if (w->cursor.vpos >= 0
13016 /* Make sure cursor.vpos specifies a row whose start and end
13017 charpos occlude point. This is because some callers of this
13018 function leave cursor.vpos at the row where the cursor was
13019 displayed during the last redisplay cycle. */
13020 && MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) <= pt_old
13021 && pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)))
13016 { 13022 {
13017 struct glyph *g1 = 13023 struct glyph *g1 =
13018 MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos; 13024 MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos;
13019 13025
13020 /* Keep the candidate whose buffer position is the closest to 13026 /* Keep the candidate whose buffer position is the closest to
17595 /* Remember the position at which this line ends. */ 17601 /* Remember the position at which this line ends. */
17596 if (!it->bidi_p) 17602 if (!it->bidi_p)
17597 row->end = row_end = it->current; 17603 row->end = row_end = it->current;
17598 else 17604 else
17599 { 17605 {
17600 EMACS_INT min_pos = ZV, max_pos = BEGV; 17606 EMACS_INT min_pos = row->start.pos.charpos, max_pos = 0;
17601 struct glyph *g; 17607 struct glyph *g;
17602 struct it save_it; 17608 struct it save_it;
17603 struct text_pos tpos; 17609 struct text_pos tpos;
17604 17610
17605 /* ROW->start and ROW->end must be the smallest and largest 17611 /* ROW->start and ROW->end must be the smallest and largest
17610 g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]; 17616 g < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
17611 g++) 17617 g++)
17612 { 17618 {
17613 if (BUFFERP (g->object)) 17619 if (BUFFERP (g->object))
17614 { 17620 {
17615 if (g->charpos < min_pos) 17621 if (g->charpos && g->charpos < min_pos)
17616 min_pos = g->charpos; 17622 min_pos = g->charpos;
17617 if (g->charpos > max_pos) 17623 if (g->charpos > max_pos)
17618 max_pos = g->charpos; 17624 max_pos = g->charpos;
17619 } 17625 }
17620 } 17626 }
17621 row->start.pos.charpos = min_pos; 17627 if (min_pos < row->start.pos.charpos)
17622 row->start.pos.bytepos = CHAR_TO_BYTE (min_pos); 17628 {
17623 /* For ROW->end, we need the display element that is _after_ 17629 row->start.pos.charpos = min_pos;
17624 max_pos, in the logical order. Note that this may be after 17630 row->start.pos.bytepos = CHAR_TO_BYTE (min_pos);
17625 skipping some invisible text. */ 17631 }
17626 save_it = *it; 17632 if (max_pos == 0)
17627 it->bidi_p = 0; 17633 max_pos = min_pos;
17628 SET_TEXT_POS (tpos, max_pos, CHAR_TO_BYTE (max_pos)); 17634 /* For ROW->end, we need the position that is _after_ max_pos,
17629 reseat_1 (it, tpos, 0); 17635 in the logical order. */
17630 set_iterator_to_next (it, 1); 17636 SET_TEXT_POS (tpos, max_pos + 1, CHAR_TO_BYTE (max_pos + 1));
17631 row->end = row_end = it->current; 17637 /* If the character at max_pos+1 is a newline, skip that as
17632 *it = save_it; 17638 well. Note that this may skip some invisible text. */
17639 if (FETCH_CHAR (tpos.bytepos) == '\n'
17640 || (FETCH_CHAR (tpos.bytepos) == '\r' && it->selective))
17641 {
17642 save_it = *it;
17643 it->bidi_p = 0;
17644 reseat_1 (it, tpos, 0);
17645 set_iterator_to_next (it, 1);
17646 row_end = it->current;
17647 *it = save_it;
17648 }
17649 else
17650 {
17651 row_end = it->current;
17652 row_end.pos = tpos;
17653 }
17654 row->end = row_end;
17633 } 17655 }
17634 17656
17635 /* Record whether this row ends inside an ellipsis. */ 17657 /* Record whether this row ends inside an ellipsis. */
17636 row->ends_in_ellipsis_p 17658 row->ends_in_ellipsis_p
17637 = (it->method == GET_FROM_DISPLAY_VECTOR 17659 = (it->method == GET_FROM_DISPLAY_VECTOR