diff src/redisplay.c @ 195:a2f645c6b9f8 r20-3b24

Import from CVS: tag r20-3b24
author cvs
date Mon, 13 Aug 2007 09:59:05 +0200
parents b405438285a2
children 41ff10fd062f
line wrap: on
line diff
--- a/src/redisplay.c	Mon Aug 13 09:58:32 2007 +0200
+++ b/src/redisplay.c	Mon Aug 13 09:59:05 2007 +0200
@@ -454,11 +454,13 @@
 
 Lisp_Object Vglobal_mode_string;
 
-/* The number of lines to try scrolling a
-  window by when point leaves the window; if
+/* The number of lines scroll a window by when point leaves the window; if
   it is <=0 then point is centered in the window */
 int scroll_step;
 
+/* Scroll up to this many lines, to bring point back on screen. */
+int scroll_conservatively;
+
 /* Marker for where to display an arrow on top of the buffer text.  */
 Lisp_Object Voverlay_arrow_position;
 /* String to display for the arrow.  */
@@ -5190,12 +5192,16 @@
      back onto the screen. */
   if (scroll_step)
     {
-      startp = vmotion (w, startp,
-			(pointm < startp) ? -scroll_step : scroll_step, 0);
-      regenerate_window (w, startp, pointm, DESIRED_DISP);
-
-      if (point_visible (w, pointm, DESIRED_DISP))
-	goto regeneration_done;
+      int scrolled = scroll_conservatively;
+      for (; scrolled >= 0; scrolled -= scroll_step)
+	{
+	  startp = vmotion (w, startp,
+			    (pointm < startp) ? -scroll_step : scroll_step, 0);
+	  regenerate_window (w, startp, pointm, DESIRED_DISP);
+
+	  if (point_visible (w, pointm, DESIRED_DISP))
+	    goto regeneration_done;
+	}
     }
 
   /* We still haven't managed to get the screen drawn with point on
@@ -8205,6 +8211,12 @@
 If that fails to bring point back on frame, point is centered instead.
 If this is zero, point is always centered after it moves off screen.
 */ );
+  scroll_step = 0;
+
+  DEFVAR_INT ("scroll-conservatively", &scroll_conservatively /*
+*Scroll up to this many lines, to bring point back on screen.
+*/ );
+  scroll_conservatively = 0;
 
   DEFVAR_BOOL_MAGIC ("truncate-partial-width-windows",
 		     &truncate_partial_width_windows /*