Mercurial > emacs
changeset 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 | a5eeeb631d8a |
children | 59df2de8b31d |
files | src/ChangeLog.bidi src/dispnew.c src/xdisp.c |
diffstat | 3 files changed, 48 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog.bidi Sat Feb 20 05:25:57 2010 -0500 +++ b/src/ChangeLog.bidi Sat Feb 20 11:22:07 2010 -0500 @@ -1,3 +1,13 @@ +2010-02-20 Eli Zaretskii <eliz@gnu.org> + + * 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. + 2010-02-13 Eli Zaretskii <eliz@gnu.org> * xdisp.c (set_cursor_from_row): Don't overwrite cursor position
--- a/src/dispnew.c Sat Feb 20 05:25:57 2010 -0500 +++ b/src/dispnew.c Sat Feb 20 11:22:07 2010 -0500 @@ -1543,6 +1543,7 @@ || a->overlapped_p != b->overlapped_p || (MATRIX_ROW_CONTINUATION_LINE_P (a) != MATRIX_ROW_CONTINUATION_LINE_P (b)) + || a->reversed_p != b->reversed_p /* Different partially visible characters on left margin. */ || a->x != b->x /* Different height. */
--- a/src/xdisp.c Sat Feb 20 05:25:57 2010 -0500 +++ b/src/xdisp.c Sat Feb 20 11:22:07 2010 -0500 @@ -13012,7 +13012,13 @@ rows whose start and end charpos occlude point. Only set w->cursor if we found a better approximation to the cursor position than we have from previously examined rows. */ - if (w->cursor.vpos >= 0) + if (w->cursor.vpos >= 0 + /* Make sure cursor.vpos specifies a row whose start and end + charpos occlude point. This is because some callers of this + function leave cursor.vpos at the row where the cursor was + displayed during the last redisplay cycle. */ + && MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) <= pt_old + && pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))) { struct glyph *g1 = MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos; @@ -17597,7 +17603,7 @@ row->end = row_end = it->current; else { - EMACS_INT min_pos = ZV, max_pos = BEGV; + EMACS_INT min_pos = row->start.pos.charpos, max_pos = 0; struct glyph *g; struct it save_it; struct text_pos tpos; @@ -17612,24 +17618,40 @@ { if (BUFFERP (g->object)) { - if (g->charpos < min_pos) + if (g->charpos && g->charpos < min_pos) min_pos = g->charpos; if (g->charpos > max_pos) max_pos = g->charpos; } } - row->start.pos.charpos = min_pos; - row->start.pos.bytepos = CHAR_TO_BYTE (min_pos); - /* For ROW->end, we need the display element that is _after_ - max_pos, in the logical order. Note that this may be after - skipping some invisible text. */ - save_it = *it; - it->bidi_p = 0; - SET_TEXT_POS (tpos, max_pos, CHAR_TO_BYTE (max_pos)); - reseat_1 (it, tpos, 0); - set_iterator_to_next (it, 1); - row->end = row_end = it->current; - *it = save_it; + if (min_pos < row->start.pos.charpos) + { + row->start.pos.charpos = min_pos; + row->start.pos.bytepos = CHAR_TO_BYTE (min_pos); + } + if (max_pos == 0) + max_pos = min_pos; + /* For ROW->end, we need the position that is _after_ max_pos, + in the logical order. */ + SET_TEXT_POS (tpos, max_pos + 1, CHAR_TO_BYTE (max_pos + 1)); + /* If the character at max_pos+1 is a newline, skip that as + well. Note that this may skip some invisible text. */ + if (FETCH_CHAR (tpos.bytepos) == '\n' + || (FETCH_CHAR (tpos.bytepos) == '\r' && it->selective)) + { + save_it = *it; + it->bidi_p = 0; + reseat_1 (it, tpos, 0); + set_iterator_to_next (it, 1); + row_end = it->current; + *it = save_it; + } + else + { + row_end = it->current; + row_end.pos = tpos; + } + row->end = row_end; } /* Record whether this row ends inside an ellipsis. */