changeset 28709:7606937fa891

(try_window_id) <all changes above window start>: Adjust positions in glyph matrix. Don't compute new window end positions.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 25 Apr 2000 19:41:30 +0000
parents 4e2497e6757e
children 6efaa4627dee
files src/xdisp.c
diffstat 1 files changed, 29 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Tue Apr 25 19:39:59 2000 +0000
+++ b/src/xdisp.c	Tue Apr 25 19:41:30 2000 +0000
@@ -7474,10 +7474,10 @@
 				     - MATRIX_ROW_START_BYTEPOS (row));
 		    }
   
-  		  increment_glyph_matrix_buffer_positions (w->current_matrix,
-							   this_line_vpos + 1,
-							   w->current_matrix->nrows,
-							   delta, delta_bytes);
+  		  increment_matrix_positions (w->current_matrix,
+					      this_line_vpos + 1,
+					      w->current_matrix->nrows,
+					      delta, delta_bytes);
 		}
 
 	      /* If this row displays text now but previously didn't,
@@ -10056,19 +10056,38 @@
 
   /* If window starts after a line end, and the last change is in
      front of that newline, then changes don't affect the display.
-     This case happens with stealth-fontification.  */
+     This case happens with stealth-fontification.  Note that although
+     the display is unchanged, glyph positions in the matrix have to
+     be adjusted, of course.  */
   row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
   if (CHARPOS (start) > BEGV
       && Z - END_UNCHANGED < CHARPOS (start) - 1
       && FETCH_BYTE (BYTEPOS (start) - 1) == '\n'
       && PT < MATRIX_ROW_END_CHARPOS (row))
     {
-      /* We have to update window end positions because the buffer's
-	 size has changed.  */
+      struct glyph_row *r0 = MATRIX_FIRST_TEXT_ROW (current_matrix);
+      int delta = CHARPOS (start) - MATRIX_ROW_START_CHARPOS (r0);
+
+      if (delta)
+	{
+	  struct glyph_row *r1 = MATRIX_BOTTOM_TEXT_ROW (current_matrix, w);
+	  int delta_bytes = BYTEPOS (start) - MATRIX_ROW_START_BYTEPOS (r0);
+
+	  increment_matrix_positions (w->current_matrix,
+				      MATRIX_ROW_VPOS (r0, current_matrix),
+				      MATRIX_ROW_VPOS (r1, current_matrix),
+				      delta, delta_bytes);
+	}
+      
+#if 0  /* If changes are all in front of the window start, the
+	  distance of the last displayed glyph from Z hasn't
+	  changed.  */
       w->window_end_pos
 	= make_number (Z - MATRIX_ROW_END_CHARPOS (row));
       w->window_end_bytepos
 	= Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
+#endif
+
       return 1;
     }
 
@@ -10383,9 +10402,9 @@
 
   /* Adjust buffer positions in reused rows.  */
   if (delta)
-    increment_glyph_matrix_buffer_positions (current_matrix,
-					     first_unchanged_at_end_vpos + dvpos,
-					     bottom_vpos, delta, delta_bytes);
+    increment_matrix_positions (current_matrix,
+				first_unchanged_at_end_vpos + dvpos,
+				bottom_vpos, delta, delta_bytes);
 
   /* Adjust Y positions.  */
   if (dy)