Mercurial > emacs
comparison src/dispnew.c @ 108656:0b28d05fa415
Initial reimplementation of calculating line edge positions in bidi lines.
dispextern.h (struct glyph_row): New members minpos and maxpos.
(MATRIX_ROW_START_CHARPOS, MATRIX_ROW_START_BYTEPOS)
(MATRIX_ROW_END_CHARPOS, MATRIX_ROW_END_BYTEPOS): Reference minpos
and maxpos members instead of start.pos and end.pos, respectively.
xdisp.c (display_line): Compare IT_CHARPOS with the position in
row->start.pos, rather than with MATRIX_ROW_START_CHARPOS.
(cursor_row_p): Use row->end.pos rather than MATRIX_ROW_END_CHARPOS.
(try_window_reusing_current_matrix, try_window_id): Use
ROW->minpos rather than ROW->start.pos.
(init_from_display_pos, init_iterator): Use EMACS_INT for
character and byte positions.
(find_row_edges): Renamed from find_row_end. Accept additional
arguments for minimum and maximum buffer positions seen by
display_line for this row. Don't use iterator to find the
position following the maximum one; instead, increment the
position found by display_line directly.
(display_line): Record minimum and maximum buffer positions for
glyphs in this row. Record the position of the newline that
terminates the line.
dispnew.c (increment_row_positions, check_matrix_invariants):
Increment and check row->start.pos and row->end.pos, in addition
to MATRIX_ROW_START_CHARPOS and MATRIX_ROW_END_CHARPOS.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Tue, 18 May 2010 18:22:15 +0300 |
parents | 74557d25410e |
children | 8cdd65a4d95c |
comparison
equal
deleted
inserted
replaced
108646:f5b2fcb51f42 | 108656:0b28d05fa415 |
---|---|
1186 /* Increment start and end positions. */ | 1186 /* Increment start and end positions. */ |
1187 MATRIX_ROW_START_CHARPOS (row) += delta; | 1187 MATRIX_ROW_START_CHARPOS (row) += delta; |
1188 MATRIX_ROW_START_BYTEPOS (row) += delta_bytes; | 1188 MATRIX_ROW_START_BYTEPOS (row) += delta_bytes; |
1189 MATRIX_ROW_END_CHARPOS (row) += delta; | 1189 MATRIX_ROW_END_CHARPOS (row) += delta; |
1190 MATRIX_ROW_END_BYTEPOS (row) += delta_bytes; | 1190 MATRIX_ROW_END_BYTEPOS (row) += delta_bytes; |
1191 CHARPOS (row->start.pos) += delta; | |
1192 BYTEPOS (row->start.pos) += delta_bytes; | |
1193 CHARPOS (row->end.pos) += delta; | |
1194 BYTEPOS (row->end.pos) += delta_bytes; | |
1191 | 1195 |
1192 if (!row->enabled_p) | 1196 if (!row->enabled_p) |
1193 return; | 1197 return; |
1194 | 1198 |
1195 /* Increment positions in glyphs. */ | 1199 /* Increment positions in glyphs. */ |
1746 last_text_row = row; | 1750 last_text_row = row; |
1747 | 1751 |
1748 /* Check that character and byte positions are in sync. */ | 1752 /* Check that character and byte positions are in sync. */ |
1749 xassert (MATRIX_ROW_START_BYTEPOS (row) | 1753 xassert (MATRIX_ROW_START_BYTEPOS (row) |
1750 == CHAR_TO_BYTE (MATRIX_ROW_START_CHARPOS (row))); | 1754 == CHAR_TO_BYTE (MATRIX_ROW_START_CHARPOS (row))); |
1755 xassert (BYTEPOS (row->start.pos) | |
1756 == CHAR_TO_BYTE (CHARPOS (row->start.pos))); | |
1751 | 1757 |
1752 /* CHAR_TO_BYTE aborts when invoked for a position > Z. We can | 1758 /* CHAR_TO_BYTE aborts when invoked for a position > Z. We can |
1753 have such a position temporarily in case of a minibuffer | 1759 have such a position temporarily in case of a minibuffer |
1754 displaying something like `[Sole completion]' at its end. */ | 1760 displaying something like `[Sole completion]' at its end. */ |
1755 if (MATRIX_ROW_END_CHARPOS (row) < BUF_ZV (current_buffer)) | 1761 if (MATRIX_ROW_END_CHARPOS (row) < BUF_ZV (current_buffer)) |
1756 xassert (MATRIX_ROW_END_BYTEPOS (row) | 1762 { |
1757 == CHAR_TO_BYTE (MATRIX_ROW_END_CHARPOS (row))); | 1763 xassert (MATRIX_ROW_END_BYTEPOS (row) |
1764 == CHAR_TO_BYTE (MATRIX_ROW_END_CHARPOS (row))); | |
1765 xassert (BYTEPOS (row->end.pos) | |
1766 == CHAR_TO_BYTE (CHARPOS (row->end.pos))); | |
1767 } | |
1758 | 1768 |
1759 /* Check that end position of `row' is equal to start position | 1769 /* Check that end position of `row' is equal to start position |
1760 of next row. */ | 1770 of next row. */ |
1761 if (next->enabled_p && MATRIX_ROW_DISPLAYS_TEXT_P (next)) | 1771 if (next->enabled_p && MATRIX_ROW_DISPLAYS_TEXT_P (next)) |
1762 { | 1772 { |
1763 xassert (MATRIX_ROW_END_CHARPOS (row) | 1773 xassert (MATRIX_ROW_END_CHARPOS (row) |
1764 == MATRIX_ROW_START_CHARPOS (next)); | 1774 == MATRIX_ROW_START_CHARPOS (next)); |
1765 xassert (MATRIX_ROW_END_BYTEPOS (row) | 1775 xassert (MATRIX_ROW_END_BYTEPOS (row) |
1766 == MATRIX_ROW_START_BYTEPOS (next)); | 1776 == MATRIX_ROW_START_BYTEPOS (next)); |
1777 xassert (CHARPOS (row->end.pos) == CHARPOS (next->start.pos)); | |
1778 xassert (BYTEPOS (row->end.pos) == BYTEPOS (next->start.pos)); | |
1767 } | 1779 } |
1768 row = next; | 1780 row = next; |
1769 } | 1781 } |
1770 | 1782 |
1771 xassert (w->current_matrix->nrows == w->desired_matrix->nrows); | 1783 xassert (w->current_matrix->nrows == w->desired_matrix->nrows); |