changeset 6642:2fda5dd17356

(verify_charstarts): New function. (scroll_frame_lines): When updating charstarts, treat all columns alike--don't zero out any. Fix end tests of loops over i. (adjust_window_charstarts): Fix typo.
author Richard M. Stallman <rms@gnu.org>
date Sun, 03 Apr 1994 01:36:57 +0000
parents 4e76332f7b44
children 07be9ae289ce
files src/dispnew.c
diffstat 1 files changed, 80 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispnew.c	Sat Apr 02 05:52:36 1994 +0000
+++ b/src/dispnew.c	Sun Apr 03 01:36:57 1994 +0000
@@ -607,6 +607,7 @@
   register struct frame_glyphs *current_frame
     = FRAME_CURRENT_GLYPHS (frame);
   int pos_adjust;
+  int width = FRAME_WIDTH (frame);
 
   if (!line_ins_del_ok)
     return 0;
@@ -631,28 +632,6 @@
 		     sizeof (int *) * (end + amount - from),
 		     amount * sizeof (int *));
 
-      /* Adjust the lines by an amount
-	 that puts the first of them at NEWPOS.  */
-      pos_adjust = newpos - current_frame->charstarts[i][0];
-
-      /* Offset each char position in the charstarts lines we moved
-	 by pos_adjust.  */
-      for (i = from + amount; i < end; i++)
-	{
-	  int *line = current_frame->charstarts[i];
-	  int col;
-	  for (col = 0; col < current_frame->used[i]; col++)
-	    line[col] += pos_adjust;
-	}
-      for (i = from; i <= from + amount; i++)
-	{
-	  int *line = current_frame->charstarts[i];
-	  int col;
-	  line[0] = -1;
-	  for (col = 0; col < current_frame->used[i]; col++)
-	    line[col] = 0;
-	}
-
       safe_bcopy (current_frame->used + from,
 		  current_frame->used + from + amount,
 		  (end - from) * sizeof current_frame->used[0]);
@@ -665,6 +644,29 @@
 		  current_frame->enable + from + amount,
 		  (end - from) * sizeof current_frame->enable[0]);
 
+      /* Adjust the lines by an amount
+	 that puts the first of them at NEWPOS.  */
+      pos_adjust = newpos - current_frame->charstarts[from + amount][0];
+
+      /* Offset each char position in the charstarts lines we moved
+	 by pos_adjust.  */
+      for (i = from + amount; i < end + amount; i++)
+	{
+	  int *line = current_frame->charstarts[i];
+	  int col;
+	  for (col = 0; col < width; col++)
+	    if (line[col] > 0)
+	      line[col] += pos_adjust;
+	}
+      for (i = from; i < from + amount; i++)
+	{
+	  int *line = current_frame->charstarts[i];
+	  int col;
+	  line[0] = -1;
+	  for (col = 0; col < width; col++)
+	    line[col] = 0;
+	}
+
       /* Mark the lines made empty by scrolling as enabled, empty and
 	 normal video.  */
       bzero (current_frame->used + from,
@@ -726,28 +728,6 @@
 		     sizeof (int *) * (end - from - amount),
 		     amount * sizeof (int *));
 
-      /* Adjust the lines by an amount
-	 that puts the first of them at NEWPOS.  */
-      pos_adjust = newpos - current_frame->charstarts[i][0];
-
-      /* Offset each char position in the charstarts lines we moved
-	 by pos_adjust.  */
-      for (i = from + amount; i < end + amount; i++)
-	{
-	  int *line = current_frame->charstarts[i];
-	  int col;
-	  for (col = 0; col < current_frame->used[i]; col++)
-	    line[col] += pos_adjust;
-	}
-      for (i = end + amount; i <= end; i++)
-	{
-	  int *line = current_frame->charstarts[i];
-	  int col;
-	  line[0] = -1;
-	  for (col = 0; col < current_frame->used[i]; col++)
-	    line[col] = 0;
-	}
-
       safe_bcopy (current_frame->used + from,
 		  current_frame->used + from + amount,
 		  (end - from) * sizeof current_frame->used[0]);
@@ -760,6 +740,29 @@
 		  current_frame->enable + from + amount,
 		  (end - from) * sizeof current_frame->enable[0]);
 
+      /* Adjust the lines by an amount
+	 that puts the first of them at NEWPOS.  */
+      pos_adjust = newpos - current_frame->charstarts[from + amount][0];
+
+      /* Offset each char position in the charstarts lines we moved
+	 by pos_adjust.  */
+      for (i = from + amount; i < end + amount; i++)
+	{
+	  int *line = current_frame->charstarts[i];
+	  int col;
+	  for (col = 0; col < width; col++)
+	    if (line[col] > 0)
+	      line[col] += pos_adjust;
+	}
+      for (i = end + amount; i < end; i++)
+	{
+	  int *line = current_frame->charstarts[i];
+	  int col;
+	  line[0] = -1;
+	  for (col = 0; col < width; col++)
+	    line[col] = 0;
+	}
+
       /* Mark the lines made empty by scrolling as enabled, empty and
 	 normal video.  */
       bzero (current_frame->used + end + amount,
@@ -906,7 +909,7 @@
 #endif
 
 /* Adjust by ADJUST the charstart values in window W
-   before vpos VPOS, which counts relative to the frame
+   after vpos VPOS, which counts relative to the frame
    (not relative to W itself).  */
 
 void
@@ -917,11 +920,11 @@
 {
   int left = XFASTINT (w->left);
   int top = XFASTINT (w->top);
-  int right = left + window_internal_height (w);
-  int height = window_internal_height (w);
+  int right = left + window_internal_width (w);
+  int bottom = top + window_internal_height (w);
   int i;
 
-  for (i = vpos + 1; i < top + height; i++)
+  for (i = vpos + 1; i < bottom; i++)
     {
       int *charstart
 	= FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[i];
@@ -931,6 +934,35 @@
 	  charstart[j] += adjust;
     }
 }
+
+verify_charstarts (w)
+     struct window *w;
+{
+  FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
+  int i;
+  int top = XFASTINT (w->top);
+  int bottom = top + window_internal_height (w);
+  int left = XFASTINT (w->left);
+  int right = left + window_internal_width (w);
+  int next_line;
+
+  for (i = top; i < bottom; i++)
+    {
+      int j;
+      int last;
+      int *charstart
+	= FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[i];
+
+      if (i != top)
+	if (charstart[left] != next_line)
+	  abort ();
+
+      for (j = left; j < right; j++)
+	if (charstart[j] > 0)
+	  last = charstart[j];
+      next_line = last + (BUF_ZV (XBUFFER (w->buffer)) != last);
+    }
+}
 
 /* On discovering that the redisplay for a window was no good,
    cancel the columns of that window, so that when the window is