emacs-devel
[Top][All Lists]
Advanced

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

Re: The unwarranted scrolling assumption


From: Eli Zaretskii
Subject: Re: The unwarranted scrolling assumption
Date: Sat, 19 Jun 2010 17:03:46 +0300

> From: Lennart Borgman <address@hidden>
> Date: Sat, 19 Jun 2010 15:00:37 +0200
> Cc: address@hidden, address@hidden, address@hidden
> 
> On Sat, Jun 19, 2010 at 2:54 PM, Eli Zaretskii <address@hidden> wrote:
> >
> > Update: with revno 100620, I can no longer get Emacs to recenter by
> > pressing and holding the <down> arrow key, unless bidi-display-reordering
> > is non-nil.  The latter is probably due to some bug in cursor positioning
> > in set_cursor_from_row and display_line, under bidirectional display; I
> > will look into that next.
> >
> > So please try the latest trunk and see if Emacs still recenters sometimes.
> 
> Can you please instead show your patch here?

Here:

=== modified file 'src/ChangeLog'
--- src/ChangeLog       2010-06-16 20:08:41 +0000
+++ src/ChangeLog       2010-06-19 09:39:37 +0000
@@ -1,3 +1,13 @@
+2010-06-19  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (try_scrolling): Compute the limit for searching point
+       in forward scroll from scroll_max, instead of an arbitrary limit
+       of 10 screen lines.  See
+       http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00766.html
+       and
+       http://lists.gnu.org/archive/html/emacs-devel/2010-06/msg00773.html
+       for details.
+
 2010-06-16  Glenn Morris  <address@hidden>
 
        * editfns.c (Fbyte_to_string): Pacify compiler.

=== modified file 'src/xdisp.c'
--- src/xdisp.c 2010-06-01 02:34:49 +0000
+++ src/xdisp.c 2010-06-19 11:55:00 +0000
@@ -13431,14 +13431,22 @@ try_scrolling (window, just_this_one_p, 
       if (PT > CHARPOS (it.current.pos))
        {
          int y0 = line_bottom_y (&it);
-
-         /* Compute the distance from the scroll margin to PT
-            (including the height of the cursor line).  Moving the
-            iterator unconditionally to PT can be slow if PT is far
-            away, so stop 10 lines past the window bottom (is there a
-            way to do the right thing quickly?).  */
-         move_it_to (&it, PT, -1,
-                     it.last_visible_y + 10 * FRAME_LINE_HEIGHT (f),
+         /* Compute how many pixels below window bottom to stop searching
+            for PT.  This avoids costly search for PT that is far away if
+            the user limited scrolling by a small number of lines, but
+            always finds PT if scroll_conservatively is set to a large
+            number, such as most-positive-fixnum.  */
+         int slack = max (scroll_max, 10 * FRAME_LINE_HEIGHT (f));
+         int y_to_move =
+           slack >= INT_MAX - it.last_visible_y
+           ? INT_MAX
+           : it.last_visible_y + slack;
+
+         /* Compute the distance from the scroll margin to PT or to
+            the scroll limit, whichever comes first.  This should
+            include the height of the cursor line, to make that line
+            fully visible.  */
+         move_it_to (&it, PT, -1, y_to_move,
                      -1, MOVE_TO_POS | MOVE_TO_Y);
          dy = line_bottom_y (&it) - y0;
 





reply via email to

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