]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent unnecessary scrolling in bidi-reordered buffers.
authorEli Zaretskii <eliz@gnu.org>
Fri, 28 May 2010 12:00:47 +0000 (15:00 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 28 May 2010 12:00:47 +0000 (15:00 +0300)
 xdisp.c (try_cursor_movement): back up to non-continuation line only
 after finding point's row..

src/ChangeLog
src/xdisp.c

index eeee6540e686189b9925a00b68ee5014eb80b787..a530e844bf9d12a1c33cbdce59e79a3920f227e1 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-28  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (try_cursor_movement): Prevent unnecessary scrolling in
+       bidi-reordered buffers.
+
 2010-05-28  Kenichi Handa  <handa@m17n.org>
 
        * font.c (font_delete_unmatched): Check Vface_ignored_fonts.
index 31fa5f39d5fb4f092b894c203dbff750e9f1da44..a94049a780bfc7154246728c2bf8f821ce6b86d7 100644 (file)
@@ -13763,32 +13763,6 @@ try_cursor_movement (window, startp, scroll_step)
            ++row;
          if (!row->enabled_p)
            rc = CURSOR_MOVEMENT_MUST_SCROLL;
-         /* If rows are bidi-reordered, back up until we find a row
-            that does not belong to a continuation line.  This is
-            because we must consider all rows of a continued line as
-            candidates for cursor positioning, since row start and
-            end positions change non-linearly with vertical position
-            in such rows.  */
-         /* FIXME: Revisit this when glyph ``spilling'' in
-            continuation lines' rows is implemented for
-            bidi-reordered rows.  */
-         if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering))
-           {
-             while (MATRIX_ROW_CONTINUATION_LINE_P (row))
-               {
-                 xassert (row->enabled_p);
-                 --row;
-                 /* If we hit the beginning of the displayed portion
-                    without finding the first row of a continued
-                    line, give up.  */
-                 if (row <= w->current_matrix->rows)
-                   {
-                     rc = CURSOR_MOVEMENT_MUST_SCROLL;
-                     break;
-                   }
-
-               }
-           }
        }
 
       if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED)
@@ -13888,7 +13862,37 @@ try_cursor_movement (window, startp, scroll_step)
              rc = CURSOR_MOVEMENT_MUST_SCROLL;
            }
          else if (rc != CURSOR_MOVEMENT_SUCCESS
-                  && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
+                  && !NILP (XBUFFER (w->buffer)->bidi_display_reordering))
+           {
+             /* If rows are bidi-reordered and point moved, back up
+                until we find a row that does not belong to a
+                continuation line.  This is because we must consider
+                all rows of a continued line as candidates for the
+                new cursor positioning, since row start and end
+                positions change non-linearly with vertical position
+                in such rows.  */
+             /* FIXME: Revisit this when glyph ``spilling'' in
+                continuation lines' rows is implemented for
+                bidi-reordered rows.  */
+             while (MATRIX_ROW_CONTINUATION_LINE_P (row))
+               {
+                 xassert (row->enabled_p);
+                 --row;
+                 /* If we hit the beginning of the displayed portion
+                    without finding the first row of a continued
+                    line, give up.  */
+                 if (row <= w->current_matrix->rows)
+                   {
+                     rc = CURSOR_MOVEMENT_CANNOT_BE_USED;
+                     break;
+                   }
+
+               }
+           }
+         if (rc == CURSOR_MOVEMENT_SUCCESS
+             || rc == CURSOR_MOVEMENT_CANNOT_BE_USED)
+           ;
+         else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
                   && make_cursor_line_fully_visible_p)
            {
              if (PT == MATRIX_ROW_END_CHARPOS (row)