emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ff43fd07b7: Fix vertical motion in some rare bidi situations


From: Eli Zaretskii
Subject: master ff43fd07b7: Fix vertical motion in some rare bidi situations
Date: Sat, 1 Oct 2022 10:03:21 -0400 (EDT)

branch: master
commit ff43fd07b7eb25dd20facff21ec3226769efd8d8
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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.
---
 src/xdisp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index bee17bd6d7..c2e91d54ce 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10966,7 +10966,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
     {
       struct it it2;
       void *it2data = NULL;
-      ptrdiff_t start_charpos, i;
+      ptrdiff_t start_charpos, orig_charpos, i;
       int nchars_per_row
        = (it->last_visible_x - it->first_visible_x) / FRAME_COLUMN_WIDTH 
(it->f);
       bool hit_pos_limit = false;
@@ -10976,7 +10976,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
         position.  This may actually move vertically backwards,
          in case of overlays, so adjust dvpos accordingly.  */
       dvpos += it->vpos;
-      start_charpos = IT_CHARPOS (*it);
+      orig_charpos = IT_CHARPOS (*it);
       move_it_vertically_backward (it, 0);
       dvpos -= it->vpos;
 
@@ -11029,8 +11029,9 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
          RESTORE_IT (&it2, &it2, it2data);
          SAVE_IT (it2, *it, it2data);
          move_it_to (it, -1, -1, -1, it->vpos + delta, MOVE_TO_VPOS);
-         /* Move back again if we got too far ahead.  */
-         if (it->vpos - it2.vpos > delta)
+         /* Move back again if we got too far ahead,
+            or didn't move at all.  */
+         if (it->vpos - it2.vpos > delta || IT_CHARPOS (*it) == orig_charpos)
            RESTORE_IT (it, &it2, it2data);
          else
            bidi_unshelve_cache (it2data, true);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]