Mercurial > emacs
changeset 107992:27128322dda6
Continue work on R2L paragraphs in GUI sessions.
xdisp.c (set_cursor_from_row): Don't be fooled by truncated
rows: don't treat them as having zero-width characters. Improve
comments.
(extend_face_to_end_of_line): Use window_box_width to compute the
width of the stretch glyph, to account for margins. If this is
the last glyph row, use DEFAULT_FACE_ID, to avoid painting the
rest of the window with the region face.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 17 Apr 2010 12:46:44 +0300 |
parents | 74557d25410e |
children | 7a57ff6ef75c |
files | src/ChangeLog src/xdisp.c |
diffstat | 2 files changed, 39 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Apr 10 19:28:30 2010 +0300 +++ b/src/ChangeLog Sat Apr 17 12:46:44 2010 +0300 @@ -1,3 +1,15 @@ +2010-04-17 Eli Zaretskii <eliz@gnu.org> + + Continue work on R2L paragraphs in GUI sessions. + + * xdisp.c (set_cursor_from_row): Don't be fooled by truncated + rows: don't treat them as having zero-width characters. Improve + comments. + (extend_face_to_end_of_line): Use window_box_width to compute the + width of the stretch glyph, to account for margins. If this is + the last glyph row, use DEFAULT_FACE_ID, to avoid painting the + rest of the window with the region face. + 2010-04-10 Eli Zaretskii <eliz@gnu.org> Implement display of R2L paragraphs in GUI sessions.
--- a/src/xdisp.c Sat Apr 10 19:28:30 2010 +0300 +++ b/src/xdisp.c Sat Apr 17 12:46:44 2010 +0300 @@ -12587,8 +12587,8 @@ } while (end > glyph && INTEGERP ((end - 1)->object) - /* CHARPOS is zero for blanks inserted by - extend_face_to_end_of_line. */ + /* CHARPOS is zero for blanks and stretch glyphs + inserted by extend_face_to_end_of_line. */ && (end - 1)->charpos <= 0) --end; glyph_before = glyph - 1; @@ -12810,7 +12810,10 @@ } else if (match_with_avoid_cursor /* zero-width characters produce no glyphs */ - || eabs (glyph_after - glyph_before) == 1) + || ((row->reversed_p + ? glyph_after > glyphs_end + : glyph_after < glyphs_end) + && eabs (glyph_after - glyph_before) == 1)) { cursor = glyph_after; x = -1; @@ -12929,11 +12932,17 @@ } } - /* ROW could be part of a continued line, which might have other - 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 + /* ROW could be part of a continued line, which, under bidi + reordering, might have other 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 candidate rows belonging to the same continued line. */ + if (/* we already have a candidate row */ + w->cursor.vpos >= 0 + /* that candidate is not the row we are processing */ + && MATRIX_ROW (matrix, w->cursor.vpos) != row + /* the row we are processing is part of a continued line */ + && (row->continued_p || row->continuation_lines_width) /* 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 @@ -16849,21 +16858,24 @@ for (row_width = 0, g = row_start; g < row_end; g++) row_width += g->pixel_width; - stretch_width = WINDOW_BOX_RIGHT_EDGE_X(it->w) - - WINDOW_BOX_LEFT_EDGE_X(it->w) - - WINDOW_TOTAL_FRINGE_WIDTH(it->w) - - row_width; + stretch_width = window_box_width (it->w, TEXT_AREA) - row_width; if (stretch_width > 0) { stretch_ascent = (((it->ascent + it->descent) * FONT_BASE (font)) / FONT_HEIGHT (font)); saved_pos = it->position; + bzero (&it->position, sizeof it->position); saved_avoid_cursor = it->avoid_cursor_p; + it->avoid_cursor_p = 1; saved_face_id = it->face_id; - bzero (&it->position, sizeof it->position); - it->avoid_cursor_p = 1; - it->face_id = face->id; + /* The last row should get the default face, to avoid + painting the rest of the window with the region face, + if the region ends at ZV. */ + if (it->glyph_row->ends_at_zv_p) + it->face_id = DEFAULT_FACE_ID; + else + it->face_id = face->id; append_stretch_glyph (it, make_number (0), stretch_width, it->ascent + it->descent, stretch_ascent); it->position = saved_pos;