aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-05-29 13:49:21 +0300
committerEli Zaretskii2010-05-29 13:49:21 +0300
commit6d26bbb23ef6751cfcd7066c4d4006ec18408449 (patch)
treef13aa07dac6a2ada428204de01d858efc971963f /src
parenta85cde3870d61cb9cc6662e5ec6245f474146f7e (diff)
downloademacs-6d26bbb23ef6751cfcd7066c4d4006ec18408449.tar.gz
emacs-6d26bbb23ef6751cfcd7066c4d4006ec18408449.zip
Finish debugging of cursor motion in bidi-reordered lines.
xdisp.c (try_cursor_movement): 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/ChangeLog11
-rw-r--r--src/xdisp.c39
2 files changed, 30 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a530e844bf9..814b30bbdad 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,7 +1,14 @@
12010-05-29 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (try_cursor_movement): Fix the logic. Rewrite the loop
4 over continuation lines in bidi-reordered buffers. Return
5 CURSOR_MOVEMENT_MUST_SCROLL upon failure to find a suitable row,
6 rather than CURSOR_MOVEMENT_CANNOT_BE_USED.
7
12010-05-28 Eli Zaretskii <eliz@gnu.org> 82010-05-28 Eli Zaretskii <eliz@gnu.org>
2 9
3 * xdisp.c (try_cursor_movement): Prevent unnecessary scrolling in 10 * xdisp.c (try_cursor_movement): Backup to non-continuation line
4 bidi-reordered buffers. 11 only after finding point's row.
5 12
62010-05-28 Kenichi Handa <handa@m17n.org> 132010-05-28 Kenichi Handa <handa@m17n.org>
7 14
diff --git a/src/xdisp.c b/src/xdisp.c
index a94049a780b..c8043308ec8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13767,7 +13767,7 @@ try_cursor_movement (window, startp, scroll_step)
13767 13767
13768 if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED) 13768 if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED)
13769 { 13769 {
13770 int scroll_p = 0; 13770 int scroll_p = 0, must_scroll = 0;
13771 int last_y = window_text_bottom_y (w) - this_scroll_margin; 13771 int last_y = window_text_bottom_y (w) - this_scroll_margin;
13772 13772
13773 if (PT > XFASTINT (w->last_point)) 13773 if (PT > XFASTINT (w->last_point))
@@ -13860,6 +13860,7 @@ try_cursor_movement (window, startp, scroll_step)
13860 { 13860 {
13861 /* if PT is not in the glyph row, give up. */ 13861 /* if PT is not in the glyph row, give up. */
13862 rc = CURSOR_MOVEMENT_MUST_SCROLL; 13862 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13863 must_scroll = 1;
13863 } 13864 }
13864 else if (rc != CURSOR_MOVEMENT_SUCCESS 13865 else if (rc != CURSOR_MOVEMENT_SUCCESS
13865 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 13866 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
@@ -13883,17 +13884,17 @@ try_cursor_movement (window, startp, scroll_step)
13883 line, give up. */ 13884 line, give up. */
13884 if (row <= w->current_matrix->rows) 13885 if (row <= w->current_matrix->rows)
13885 { 13886 {
13886 rc = CURSOR_MOVEMENT_CANNOT_BE_USED; 13887 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13887 break; 13888 break;
13888 } 13889 }
13889 13890
13890 } 13891 }
13891 } 13892 }
13892 if (rc == CURSOR_MOVEMENT_SUCCESS 13893 if (must_scroll)
13893 || rc == CURSOR_MOVEMENT_CANNOT_BE_USED)
13894 ; 13894 ;
13895 else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) 13895 else if (rc != CURSOR_MOVEMENT_SUCCESS
13896 && make_cursor_line_fully_visible_p) 13896 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
13897 && make_cursor_line_fully_visible_p)
13897 { 13898 {
13898 if (PT == MATRIX_ROW_END_CHARPOS (row) 13899 if (PT == MATRIX_ROW_END_CHARPOS (row)
13899 && !row->ends_at_zv_p 13900 && !row->ends_at_zv_p
@@ -13919,7 +13920,8 @@ try_cursor_movement (window, startp, scroll_step)
13919 } 13920 }
13920 else if (scroll_p) 13921 else if (scroll_p)
13921 rc = CURSOR_MOVEMENT_MUST_SCROLL; 13922 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13922 else if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)) 13923 else if (rc != CURSOR_MOVEMENT_SUCCESS
13924 && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
13923 { 13925 {
13924 /* With bidi-reordered rows, there could be more than 13926 /* With bidi-reordered rows, there could be more than
13925 one candidate row whose start and end positions 13927 one candidate row whose start and end positions
@@ -13932,8 +13934,11 @@ try_cursor_movement (window, startp, scroll_step)
13932 13934
13933 do 13935 do
13934 { 13936 {
13935 rv |= set_cursor_from_row (w, row, w->current_matrix, 13937 if (MATRIX_ROW_START_CHARPOS (row) <= PT
13936 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);
13937 /* As soon as we've found the first suitable row 13942 /* As soon as we've found the first suitable row
13938 whose ends_at_zv_p flag is set, we are done. */ 13943 whose ends_at_zv_p flag is set, we are done. */
13939 if (rv 13944 if (rv
@@ -13944,19 +13949,17 @@ try_cursor_movement (window, startp, scroll_step)
13944 } 13949 }
13945 ++row; 13950 ++row;
13946 } 13951 }
13947 while (MATRIX_ROW_BOTTOM_Y (row) < last_y 13952 while ((MATRIX_ROW_CONTINUATION_LINE_P (row)
13948 && MATRIX_ROW_START_CHARPOS (row) <= PT 13953 && MATRIX_ROW_BOTTOM_Y (row) <= last_y)
13949 && PT <= MATRIX_ROW_END_CHARPOS (row) 13954 || (MATRIX_ROW_START_CHARPOS (row) == PT
13950 && cursor_row_p (w, row)); 13955 && MATRIX_ROW_BOTTOM_Y (row) < last_y));
13951 /* If we didn't find any candidate rows, or exited the 13956 /* If we didn't find any candidate rows, or exited the
13952 loop before all the candidates were examined, signal 13957 loop before all the candidates were examined, signal
13953 to the caller that this method failed. */ 13958 to the caller that this method failed. */
13954 if (rc != CURSOR_MOVEMENT_SUCCESS 13959 if (rc != CURSOR_MOVEMENT_SUCCESS
13955 && (!rv 13960 && (!rv || MATRIX_ROW_CONTINUATION_LINE_P (row)))
13956 || (MATRIX_ROW_START_CHARPOS (row) <= PT 13961 rc = CURSOR_MOVEMENT_MUST_SCROLL;
13957 && PT <= MATRIX_ROW_END_CHARPOS (row)))) 13962 else if (rv)
13958 rc = CURSOR_MOVEMENT_CANNOT_BE_USED;
13959 else
13960 rc = CURSOR_MOVEMENT_SUCCESS; 13963 rc = CURSOR_MOVEMENT_SUCCESS;
13961 } 13964 }
13962 else 13965 else