# HG changeset patch # User Eli Zaretskii # Date 1275048047 -10800 # Node ID d54e74c34f05560680e152570a3df267fc8ba8b4 # Parent 93729e1f822d049ac3a70a2341b60704224333cd Prevent unnecessary scrolling in bidi-reordered buffers. xdisp.c (try_cursor_movement): back up to non-continuation line only after finding point's row.. diff -r 93729e1f822d -r d54e74c34f05 src/ChangeLog --- a/src/ChangeLog Fri May 28 15:46:28 2010 +0900 +++ b/src/ChangeLog Fri May 28 15:00:47 2010 +0300 @@ -1,3 +1,8 @@ +2010-05-28 Eli Zaretskii + + * xdisp.c (try_cursor_movement): Prevent unnecessary scrolling in + bidi-reordered buffers. + 2010-05-28 Kenichi Handa * font.c (font_delete_unmatched): Check Vface_ignored_fonts. diff -r 93729e1f822d -r d54e74c34f05 src/xdisp.c --- a/src/xdisp.c Fri May 28 15:46:28 2010 +0900 +++ b/src/xdisp.c Fri May 28 15:00:47 2010 +0300 @@ -13763,32 +13763,6 @@ ++row; if (!row->enabled_p) rc = CURSOR_MOVEMENT_MUST_SCROLL; - /* If rows are bidi-reordered, back up until we find a row - that does not belong to a continuation line. This is - because we must consider all rows of a continued line as - candidates for cursor positioning, since row start and - end positions change non-linearly with vertical position - in such rows. */ - /* FIXME: Revisit this when glyph ``spilling'' in - continuation lines' rows is implemented for - bidi-reordered rows. */ - if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)) - { - while (MATRIX_ROW_CONTINUATION_LINE_P (row)) - { - xassert (row->enabled_p); - --row; - /* If we hit the beginning of the displayed portion - without finding the first row of a continued - line, give up. */ - if (row <= w->current_matrix->rows) - { - rc = CURSOR_MOVEMENT_MUST_SCROLL; - break; - } - - } - } } if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED) @@ -13888,7 +13862,37 @@ rc = CURSOR_MOVEMENT_MUST_SCROLL; } else if (rc != CURSOR_MOVEMENT_SUCCESS - && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) + && !NILP (XBUFFER (w->buffer)->bidi_display_reordering)) + { + /* If rows are bidi-reordered and point moved, back up + until we find a row that does not belong to a + continuation line. This is because we must consider + all rows of a continued line as candidates for the + new cursor positioning, since row start and end + positions change non-linearly with vertical position + in such rows. */ + /* FIXME: Revisit this when glyph ``spilling'' in + continuation lines' rows is implemented for + bidi-reordered rows. */ + while (MATRIX_ROW_CONTINUATION_LINE_P (row)) + { + xassert (row->enabled_p); + --row; + /* If we hit the beginning of the displayed portion + without finding the first row of a continued + line, give up. */ + if (row <= w->current_matrix->rows) + { + rc = CURSOR_MOVEMENT_CANNOT_BE_USED; + break; + } + + } + } + if (rc == CURSOR_MOVEMENT_SUCCESS + || rc == CURSOR_MOVEMENT_CANNOT_BE_USED) + ; + else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) && make_cursor_line_fully_visible_p) { if (PT == MATRIX_ROW_END_CHARPOS (row)