aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2022-10-01 17:01:15 +0300
committerEli Zaretskii2022-10-01 17:01:15 +0300
commitff43fd07b7eb25dd20facff21ec3226769efd8d8 (patch)
treeda0df9d20b933e53056f935ba84f6794a28e794b /src
parent3faa508eba84a1983732099cbd3cc1eaad404158 (diff)
downloademacs-ff43fd07b7eb25dd20facff21ec3226769efd8d8.tar.gz
emacs-ff43fd07b7eb25dd20facff21ec3226769efd8d8.zip
Fix vertical motion in some rare bidi situations
* src/xdisp.c (move_it_by_lines): Handle the case where we didn't move vertically at all.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index bee17bd6d7f..c2e91d54ce1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10966,7 +10966,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
10966 { 10966 {
10967 struct it it2; 10967 struct it it2;
10968 void *it2data = NULL; 10968 void *it2data = NULL;
10969 ptrdiff_t start_charpos, i; 10969 ptrdiff_t start_charpos, orig_charpos, i;
10970 int nchars_per_row 10970 int nchars_per_row
10971 = (it->last_visible_x - it->first_visible_x) / FRAME_COLUMN_WIDTH (it->f); 10971 = (it->last_visible_x - it->first_visible_x) / FRAME_COLUMN_WIDTH (it->f);
10972 bool hit_pos_limit = false; 10972 bool hit_pos_limit = false;
@@ -10976,7 +10976,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
10976 position. This may actually move vertically backwards, 10976 position. This may actually move vertically backwards,
10977 in case of overlays, so adjust dvpos accordingly. */ 10977 in case of overlays, so adjust dvpos accordingly. */
10978 dvpos += it->vpos; 10978 dvpos += it->vpos;
10979 start_charpos = IT_CHARPOS (*it); 10979 orig_charpos = IT_CHARPOS (*it);
10980 move_it_vertically_backward (it, 0); 10980 move_it_vertically_backward (it, 0);
10981 dvpos -= it->vpos; 10981 dvpos -= it->vpos;
10982 10982
@@ -11029,8 +11029,9 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
11029 RESTORE_IT (&it2, &it2, it2data); 11029 RESTORE_IT (&it2, &it2, it2data);
11030 SAVE_IT (it2, *it, it2data); 11030 SAVE_IT (it2, *it, it2data);
11031 move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS); 11031 move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS);
11032 /* Move back again if we got too far ahead. */ 11032 /* Move back again if we got too far ahead,
11033 if (it->vpos - it2.vpos > delta) 11033 or didn't move at all. */
11034 if (it->vpos - it2.vpos > delta || IT_CHARPOS (*it) == orig_charpos)
11034 RESTORE_IT (it, &it2, it2data); 11035 RESTORE_IT (it, &it2, it2data);
11035 else 11036 else
11036 bidi_unshelve_cache (it2data, true); 11037 bidi_unshelve_cache (it2data, true);