From 26cdf52838e1711c9659d6d3908a24805c08925b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 17 Apr 2010 15:33:05 +0300 Subject: [PATCH] Mirror continuation indicators for R2L lines; fix face extension on TTY. xdisp.c (extend_face_to_end_of_line): Fix face extension at ZV. term.c (produce_special_glyphs): Mirror the backslash continuation character in R2L lines. xdisp.c (set_cursor_from_row, display_line): Use MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of row->continuation_lines_width. fringe.c (update_window_fringes): For R2L rows, swap the bitmaps of continuation indicators on the fringes. --- src/ChangeLog | 12 ++++++++++++ src/fringe.c | 6 ++++-- src/term.c | 9 +++++++-- src/xdisp.c | 18 ++++++++++++------ 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3d5ba045168..8decf682bb8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,17 @@ 2010-04-17 Eli Zaretskii + * xdisp.c (extend_face_to_end_of_line): Fix face extension at ZV. + + * term.c (produce_special_glyphs): Mirror the backslash + continuation character in R2L lines. + + * xdisp.c (set_cursor_from_row, display_line): Use + MATRIX_ROW_CONTINUATION_LINE_P instead of testing value of + row->continuation_lines_width. + + * fringe.c (update_window_fringes): For R2L rows, swap the bitmaps + of continuation indicators on the fringes. + * xdisp.c (next_element_from_buffer): Don't call bidi_paragraph_init if we are at ZV. Fixes a crash when reseated to ZV by try_window_reusing_current_matrix. diff --git a/src/fringe.c b/src/fringe.c index 335dde03c8a..cfb944d58d1 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -1090,7 +1090,8 @@ update_window_fringes (w, keep_current_p) : LEFT_FRINGE (2, Qtop, 0)); else if (row->indicate_eob_p && EQ (boundary_bot, Qleft)) left = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p); - else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) + else if ((!row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row)) + || (row->reversed_p && row->continued_p)) left = LEFT_FRINGE (4, Qcontinuation, 0); else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft)) left = LEFT_FRINGE (5, Qempty_line, 0); @@ -1117,7 +1118,8 @@ update_window_fringes (w, keep_current_p) : RIGHT_FRINGE (2, Qtop, 0)); else if (row->indicate_eob_p && EQ (boundary_bot, Qright)) right = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p); - else if (row->continued_p) + else if ((!row->reversed_p && row->continued_p) + || (row->reversed_p && MATRIX_ROW_CONTINUATION_LINE_P (row))) right = RIGHT_FRINGE (4, Qcontinuation, 0); else if (row->indicate_top_line_p && EQ (arrow_top, Qright)) right = RIGHT_FRINGE (6, Qup, 0); diff --git a/src/term.c b/src/term.c index 718a20d4164..31e0ad223db 100644 --- a/src/term.c +++ b/src/term.c @@ -1889,12 +1889,16 @@ produce_special_glyphs (it, what) if (what == IT_CONTINUATION) { - /* Continuation glyph. */ - SET_GLYPH_FROM_CHAR (glyph, '\\'); + /* Continuation glyph. For R2L lines, we mirror it by hand. */ + if (it->bidi_it.paragraph_dir == R2L) + SET_GLYPH_FROM_CHAR (glyph, '/'); + else + SET_GLYPH_FROM_CHAR (glyph, '\\'); if (it->dp && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc)) && GLYPH_CODE_CHAR_VALID_P (gc)) { + /* FIXME: Should we mirror GC for R2L lines? */ SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); spec_glyph_lookup_face (XWINDOW (it->window), &glyph); } @@ -1907,6 +1911,7 @@ produce_special_glyphs (it, what) && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc)) && GLYPH_CODE_CHAR_VALID_P (gc)) { + /* FIXME: Should we mirror GC for R2L lines? */ SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); spec_glyph_lookup_face (XWINDOW (it->window), &glyph); } diff --git a/src/xdisp.c b/src/xdisp.c index b278538f625..475a83449a6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12949,7 +12949,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) /* 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) + && (row->continued_p || MATRIX_ROW_CONTINUATION_LINE_P (row)) /* 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 @@ -16876,9 +16876,9 @@ extend_face_to_end_of_line (it) saved_avoid_cursor = it->avoid_cursor_p; it->avoid_cursor_p = 1; saved_face_id = it->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. */ + /* The last row's stretch glyph 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 @@ -16909,7 +16909,13 @@ extend_face_to_end_of_line (it) it->object = make_number (0); it->c = ' '; it->len = 1; - it->face_id = face->id; + /* The last row's blank glyphs 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; PRODUCE_GLYPHS (it); @@ -17810,7 +17816,7 @@ display_line (it) *it = save_it; } else if (!row->continued_p - && row->continuation_lines_width + && MATRIX_ROW_CONTINUATION_LINE_P (row) && it->eol_pos.charpos > 0) { /* Last row of a continued line. Use the position -- 2.39.2