changeset 108821:d54e74c34f05

Prevent unnecessary scrolling in bidi-reordered buffers. xdisp.c (try_cursor_movement): back up to non-continuation line only after finding point's row..
author Eli Zaretskii <eliz@gnu.org>
date Fri, 28 May 2010 15:00:47 +0300
parents 93729e1f822d
children 69d973cd0292
files src/ChangeLog src/xdisp.c
diffstat 2 files changed, 36 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri May 28 15:46:28 2010 +0900
+++ b/src/ChangeLog	Fri May 28 15:00:47 2010 +0300
@@ -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.
--- a/src/xdisp.c	Fri May 28 15:46:28 2010 +0900
+++ b/src/xdisp.c	Fri May 28 15:00:47 2010 +0300
@@ -13763,32 +13763,6 @@
 	    ++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 @@
 	      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)