changeset 21845:1bae35c78db2

(redisplay_window): Update STARTP_BYTE alongside with STARTP. New variable scroll_margin_bytepos, to parallel scroll_margin_pos. Fix arguments of pos_tab_offset to agree with the first argument of compute_motion.
author Andreas Schwab <schwab@suse.de>
date Wed, 29 Apr 1998 09:46:49 +0000
parents 840db1d2d15c
children 486ac68ce051
files src/xdisp.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Wed Apr 29 09:44:06 1998 +0000
+++ b/src/xdisp.c	Wed Apr 29 09:46:49 1998 +0000
@@ -1952,6 +1952,7 @@
 	      run_hook_with_args_2 (Qwindow_scroll_functions, window,
 				    make_number (startp));
 	      startp = marker_position (w->start);
+	      startp_byte = marker_byte_position (w->start);
 	    }
 	}
       XSETFASTINT (w->last_modified, 0);
@@ -2203,7 +2204,7 @@
       && startp >= BEGV && startp <= ZV)
     {
       int this_scroll_margin = scroll_margin;
-      int scroll_margin_pos;
+      int scroll_margin_pos, scroll_margin_bytepos;
 
       /* Don't use a scroll margin that is negative or too large.  */
       if (this_scroll_margin < 0)
@@ -2217,14 +2218,19 @@
 	{
 	  pos = *vmotion (scroll_margin_pos, -this_scroll_margin, w);
 	  scroll_margin_pos = pos.bufpos;
+	  scroll_margin_bytepos = pos.bytepos;
 	}
+      else
+	scroll_margin_bytepos = CHAR_TO_BYTE (scroll_margin_pos);
+
       if (PT >= scroll_margin_pos)
 	{
 	  struct position pos;
 	  pos = *compute_motion (scroll_margin_pos, 0, 0, 0,
 				 PT, XFASTINT (w->height), 0,
 				 XFASTINT (w->width), XFASTINT (w->hscroll),
-				 pos_tab_offset (w, startp, startp_byte),
+				 pos_tab_offset (w, scroll_margin_pos,
+						 scroll_margin_bytepos),
 				 w);
 	  if (pos.vpos > scroll_conservatively)
 	    goto scroll_fail_1;
@@ -2263,7 +2269,7 @@
 	  pos = *compute_motion (PT, 0, 0, 0,
 				 scroll_margin_pos, XFASTINT (w->height), 0,
 				 XFASTINT (w->width), XFASTINT (w->hscroll),
-				 pos_tab_offset (w, startp, startp_byte),
+				 pos_tab_offset (w, PT, PT_BYTE),
 				 w);
 	  if (pos.vpos > scroll_conservatively)
 	    goto scroll_fail_1;