changeset 6650:a406a09cb770

(redisplay): do_verify_charstarts controls whether to call verify_charstarts. Fix one-off when checking for the last line.
author Richard M. Stallman <rms@gnu.org>
date Sun, 03 Apr 1994 08:10:46 +0000
parents 1305248ee38a
children 714341c56a9a
files src/xdisp.c
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Sun Apr 03 08:09:45 1994 +0000
+++ b/src/xdisp.c	Sun Apr 03 08:10:46 1994 +0000
@@ -505,6 +505,8 @@
    See Fcall_process; if you called it from here, it could be
    entered recursively.  */
 
+static int do_verify_charstarts;
+
 void
 redisplay ()
 {
@@ -623,7 +625,10 @@
 	  if (cursor_vpos >= 0 && this_line_bufpos
 	      && this_line_endpos == tlendpos)
 	    {
-	      if (this_line_vpos < XFASTINT (w->top) + window_internal_height (w))
+	      /* If this is not the window's last line,
+		 we must adjust the charstarts of the lines below.  */
+	      if (this_line_vpos + 1
+		  < XFASTINT (w->top) + window_internal_height (w))
 		{
 		  int left = XFASTINT (w->left);
 		  int *charstart_next_line
@@ -832,7 +837,8 @@
 	  w->window_end_valid = Qt;
 	  last_arrow_position = Voverlay_arrow_position;
 	  last_arrow_string = Voverlay_arrow_string;
-	  verify_charstarts (w);
+	  if (do_verify_charstarts)
+	    verify_charstarts (w);
 	  if (frame_up_to_date_hook != 0)
 	    (*frame_up_to_date_hook) (selected_frame);
 	}
@@ -1601,7 +1607,14 @@
 	  blank_end_of_window = 1;
 	}
       else if (!scroll_amount)
-	{}
+	{
+	  /* Even if we don't need to scroll, we must adjust the
+	     charstarts of subsequent lines (that we won't redisplay)
+	     according to the amount of text inserted or deleted.  */
+	  int oldpos = FRAME_CURRENT_GLYPHS (f)->charstarts[ep.vpos + top][0];
+	  int adjust = ep.bufpos - oldpos;
+	  adjust_window_charstarts (w, ep.vpos + top - 1, adjust);
+	}
       else if (bp.bufpos == Z - end_unchanged)
 	{
 	  /* If reprinting everything is nearly as fast as scrolling,