aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-05-29 15:51:01 +0300
committerEli Zaretskii2010-05-29 15:51:01 +0300
commit06fa4a23522821fc3a4e93c7ca505bae4d4733de (patch)
tree90a74447c7b8a58496071a7083139cfabf4d278b /src
parent9b655a0a2297971654ab4e94a9103a8a98863e84 (diff)
parent6d26bbb23ef6751cfcd7066c4d4006ec18408449 (diff)
downloademacs-06fa4a23522821fc3a4e93c7ca505bae4d4733de.tar.gz
emacs-06fa4a23522821fc3a4e93c7ca505bae4d4733de.zip
Fix cursor motion in bidi-reordered continued lines.
xdisp.c (try_cursor_movement): Backup to non-continuation line only after finding point's row. Fix the logic. Rewrite the loop over continuation lines in bidi-reordered buffers. Return CURSOR_MOVEMENT_MUST_SCROLL upon failure to find a suitable row, rather than CURSOR_MOVEMENT_CANNOT_BE_USED.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/xdisp.c89
2 files changed, 57 insertions, 41 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 18e0aab2a6d..718f2b385d8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12010-05-29 Eli Zaretskii <eliz@gnu.org>
2
3 Fix cursor motion in bidi-reordered continued lines.
4 * xdisp.c (try_cursor_movement): Backup to non-continuation line
5 only after finding point's row. Fix the logic. Rewrite the loop
6 over continuation lines in bidi-reordered buffers. Return
7 CURSOR_MOVEMENT_MUST_SCROLL upon failure to find a suitable row,
8 rather than CURSOR_MOVEMENT_CANNOT_BE_USED.
9
12010-05-28 Michael Albinus <michael.albinus@gmx.de> 102010-05-28 Michael Albinus <michael.albinus@gmx.de>
2 11
3 * fileio.c (Fdelete_file): Pass TRASH arg to handler call. 12 * fileio.c (Fdelete_file): Pass TRASH arg to handler call.
diff --git a/src/xdisp.c b/src/xdisp.c
index 31fa5f39d5f..c8043308ec8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13763,37 +13763,11 @@ try_cursor_movement (window, startp, scroll_step)
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, must_scroll = 0;
13797 int last_y = window_text_bottom_y (w) - this_scroll_margin; 13771 int last_y = window_text_bottom_y (w) - this_scroll_margin;
13798 13772
13799 if (PT > XFASTINT (w->last_point)) 13773 if (PT > XFASTINT (w->last_point))
@@ -13886,10 +13860,41 @@ try_cursor_movement (window, startp, scroll_step)
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;
13863 must_scroll = 1;
13889 } 13864 }
13890 else if (rc != CURSOR_MOVEMENT_SUCCESS 13865 else if (rc != CURSOR_MOVEMENT_SUCCESS
13891 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) 13866 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
13892 && make_cursor_line_fully_visible_p) 13867 {
13868 /* If rows are bidi-reordered and point moved, back up
13869 until we find a row that does not belong to a
13870 continuation line. This is because we must consider
13871 all rows of a continued line as candidates for the
13872 new cursor positioning, since row start and end
13873 positions change non-linearly with vertical position
13874 in such rows. */
13875 /* FIXME: Revisit this when glyph ``spilling'' in
13876 continuation lines' rows is implemented for
13877 bidi-reordered rows. */
13878 while (MATRIX_ROW_CONTINUATION_LINE_P (row))
13879 {
13880 xassert (row->enabled_p);
13881 --row;
13882 /* If we hit the beginning of the displayed portion
13883 without finding the first row of a continued
13884 line, give up. */
13885 if (row <= w->current_matrix->rows)
13886 {
13887 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13888 break;
13889 }
13890
13891 }
13892 }
13893 if (must_scroll)
13894 ;
13895 else if (rc != CURSOR_MOVEMENT_SUCCESS
13896 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
13897 && make_cursor_line_fully_visible_p)
13893 { 13898 {
13894 if (PT == MATRIX_ROW_END_CHARPOS (row) 13899 if (PT == MATRIX_ROW_END_CHARPOS (row)
13895 && !row->ends_at_zv_p 13900 && !row->ends_at_zv_p
@@ -13915,7 +13920,8 @@ try_cursor_movement (window, startp, scroll_step)
13915 } 13920 }
13916 else if (scroll_p) 13921 else if (scroll_p)
13917 rc = CURSOR_MOVEMENT_MUST_SCROLL; 13922 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13918 else if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 13923 else if (rc != CURSOR_MOVEMENT_SUCCESS
13924 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
13919 { 13925 {
13920 /* With bidi-reordered rows, there could be more than 13926 /* With bidi-reordered rows, there could be more than
13921 one candidate row whose start and end positions 13927 one candidate row whose start and end positions
@@ -13928,8 +13934,11 @@ try_cursor_movement (window, startp, scroll_step)
13928 13934
13929 do 13935 do
13930 { 13936 {
13931 rv |= set_cursor_from_row (w, row, w->current_matrix, 13937 if (MATRIX_ROW_START_CHARPOS (row) <= PT
13932 0, 0, 0, 0); 13938 && PT <= MATRIX_ROW_END_CHARPOS (row)
13939 && cursor_row_p (w, row))
13940 rv |= set_cursor_from_row (w, row, w->current_matrix,
13941 0, 0, 0, 0);
13933 /* As soon as we've found the first suitable row 13942 /* As soon as we've found the first suitable row
13934 whose ends_at_zv_p flag is set, we are done. */ 13943 whose ends_at_zv_p flag is set, we are done. */
13935 if (rv 13944 if (rv
@@ -13940,19 +13949,17 @@ try_cursor_movement (window, startp, scroll_step)
13940 } 13949 }
13941 ++row; 13950 ++row;
13942 } 13951 }
13943 while (MATRIX_ROW_BOTTOM_Y (row) < last_y 13952 while ((MATRIX_ROW_CONTINUATION_LINE_P (row)
13944 && MATRIX_ROW_START_CHARPOS (row) <= PT 13953 && MATRIX_ROW_BOTTOM_Y (row) <= last_y)
13945 && PT <= MATRIX_ROW_END_CHARPOS (row) 13954 || (MATRIX_ROW_START_CHARPOS (row) == PT
13946 && cursor_row_p (w, row)); 13955 && MATRIX_ROW_BOTTOM_Y (row) < last_y));
13947 /* If we didn't find any candidate rows, or exited the 13956 /* If we didn't find any candidate rows, or exited the
13948 loop before all the candidates were examined, signal 13957 loop before all the candidates were examined, signal
13949 to the caller that this method failed. */ 13958 to the caller that this method failed. */
13950 if (rc != CURSOR_MOVEMENT_SUCCESS 13959 if (rc != CURSOR_MOVEMENT_SUCCESS
13951 && (!rv 13960 && (!rv || MATRIX_ROW_CONTINUATION_LINE_P (row)))
13952 || (MATRIX_ROW_START_CHARPOS (row) <= PT 13961 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13953 && PT <= MATRIX_ROW_END_CHARPOS (row)))) 13962 else if (rv)
13954 rc = CURSOR_MOVEMENT_CANNOT_BE_USED;
13955 else
13956 rc = CURSOR_MOVEMENT_SUCCESS; 13963 rc = CURSOR_MOVEMENT_SUCCESS;
13957 } 13964 }
13958 else 13965 else