Mercurial > emacs
comparison src/xdisp.c @ 108821:d54e74c34f05
Prevent unnecessary scrolling in bidi-reordered buffers.
xdisp.c (try_cursor_movement): back up to non-continuation line only
after finding point's row..
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 28 May 2010 15:00:47 +0300 |
parents | 78199a49c4bf |
children | 69d973cd0292 |
comparison
equal
deleted
inserted
replaced
108815:93729e1f822d | 108821:d54e74c34f05 |
---|---|
13761 row = MATRIX_ROW (w->current_matrix, w->last_cursor.vpos); | 13761 row = MATRIX_ROW (w->current_matrix, w->last_cursor.vpos); |
13762 if (row->mode_line_p) | 13762 if (row->mode_line_p) |
13763 ++row; | 13763 ++row; |
13764 if (!row->enabled_p) | 13764 if (!row->enabled_p) |
13765 rc = CURSOR_MOVEMENT_MUST_SCROLL; | 13765 rc = CURSOR_MOVEMENT_MUST_SCROLL; |
13766 /* If rows are bidi-reordered, back up until we find a row | |
13767 that does not belong to a continuation line. This is | |
13768 because we must consider all rows of a continued line as | |
13769 candidates for cursor positioning, since row start and | |
13770 end positions change non-linearly with vertical position | |
13771 in such rows. */ | |
13772 /* FIXME: Revisit this when glyph ``spilling'' in | |
13773 continuation lines' rows is implemented for | |
13774 bidi-reordered rows. */ | |
13775 if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)) | |
13776 { | |
13777 while (MATRIX_ROW_CONTINUATION_LINE_P (row)) | |
13778 { | |
13779 xassert (row->enabled_p); | |
13780 --row; | |
13781 /* If we hit the beginning of the displayed portion | |
13782 without finding the first row of a continued | |
13783 line, give up. */ | |
13784 if (row <= w->current_matrix->rows) | |
13785 { | |
13786 rc = CURSOR_MOVEMENT_MUST_SCROLL; | |
13787 break; | |
13788 } | |
13789 | |
13790 } | |
13791 } | |
13792 } | 13766 } |
13793 | 13767 |
13794 if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED) | 13768 if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED) |
13795 { | 13769 { |
13796 int scroll_p = 0; | 13770 int scroll_p = 0; |
13886 { | 13860 { |
13887 /* if PT is not in the glyph row, give up. */ | 13861 /* if PT is not in the glyph row, give up. */ |
13888 rc = CURSOR_MOVEMENT_MUST_SCROLL; | 13862 rc = CURSOR_MOVEMENT_MUST_SCROLL; |
13889 } | 13863 } |
13890 else if (rc != CURSOR_MOVEMENT_SUCCESS | 13864 else if (rc != CURSOR_MOVEMENT_SUCCESS |
13891 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) | 13865 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering)) |
13866 { | |
13867 /* If rows are bidi-reordered and point moved, back up | |
13868 until we find a row that does not belong to a | |
13869 continuation line. This is because we must consider | |
13870 all rows of a continued line as candidates for the | |
13871 new cursor positioning, since row start and end | |
13872 positions change non-linearly with vertical position | |
13873 in such rows. */ | |
13874 /* FIXME: Revisit this when glyph ``spilling'' in | |
13875 continuation lines' rows is implemented for | |
13876 bidi-reordered rows. */ | |
13877 while (MATRIX_ROW_CONTINUATION_LINE_P (row)) | |
13878 { | |
13879 xassert (row->enabled_p); | |
13880 --row; | |
13881 /* If we hit the beginning of the displayed portion | |
13882 without finding the first row of a continued | |
13883 line, give up. */ | |
13884 if (row <= w->current_matrix->rows) | |
13885 { | |
13886 rc = CURSOR_MOVEMENT_CANNOT_BE_USED; | |
13887 break; | |
13888 } | |
13889 | |
13890 } | |
13891 } | |
13892 if (rc == CURSOR_MOVEMENT_SUCCESS | |
13893 || rc == CURSOR_MOVEMENT_CANNOT_BE_USED) | |
13894 ; | |
13895 else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) | |
13892 && make_cursor_line_fully_visible_p) | 13896 && make_cursor_line_fully_visible_p) |
13893 { | 13897 { |
13894 if (PT == MATRIX_ROW_END_CHARPOS (row) | 13898 if (PT == MATRIX_ROW_END_CHARPOS (row) |
13895 && !row->ends_at_zv_p | 13899 && !row->ends_at_zv_p |
13896 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) | 13900 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) |