changeset 38588:08a4c6c00af0

(init_from_display_pos): If POS is in an overlay string, deal with the first overlay string having an image `display' property. (try_window_reusing_current_matrix, compute_line_metrics): Fix computation of row's visible height for the case that part of the row is invisible above and part of the row is at the same time invisible below the window.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 27 Jul 2001 15:29:16 +0000
parents 42e75caf68ff
children f5d08cdf180b
files src/xdisp.c
diffstat 1 files changed, 26 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Fri Jul 27 15:28:46 2001 +0000
+++ b/src/xdisp.c	Fri Jul 27 15:29:16 2001 +0000
@@ -1835,11 +1835,18 @@
      after-string.  */
   init_iterator (it, w, charpos, bytepos, NULL, DEFAULT_FACE_ID);
 
-  /* If position is within an overlay string, set up IT to
-     the right overlay string.  */
+  /* If position is within an overlay string, set up IT to the right
+     overlay string.  */
   if (pos->overlay_string_index >= 0)
     {
       int relative_index;
+
+      /* If the first overlay string happens to have a `display'
+	 property for an image, the iterator will be set up for that
+	 image, and we have to undo that setup first before we can
+	 correct the overlay string index.  */
+      if (it->method == next_element_from_image)
+	pop_it (it);
       
       /* We already have the first chunk of overlay strings in
 	 IT->overlay_strings.  Load more until the one for
@@ -10481,7 +10488,7 @@
   struct glyph_row *last_reused_text_row;
   struct glyph_row *start_row;
   int start_vpos, min_y, max_y;
-  
+
   if (/* This function doesn't handle terminal frames.  */
       !FRAME_WINDOW_P (f)
       /* Don't try to reuse the display if windows have been split
@@ -10623,14 +10630,12 @@
 	       ++row)
 	    {
 	      row->y = it.current_y;
+	      row->visible_height = row->height;
 
 	      if (row->y < min_y)
-		row->visible_height = row->height - (min_y - row->y);
-	      else if (row->y + row->height > max_y)
-		row->visible_height
-		  = row->height - (row->y + row->height - max_y);
-	      else
-		row->visible_height = row->height;
+		row->visible_height -= min_y - row->y;
+	      if (row->y + row->height > max_y)
+		row->visible_height -= row->y + row->height - max_y;
 	      
 	      it.current_y += row->height;
 
@@ -10785,13 +10790,11 @@
       for (row = first_reusable_row; row < first_row_to_display; ++row)
 	{
 	  row->y -= dy;
+	  row->visible_height = row->height;
 	  if (row->y < min_y)
-	    row->visible_height = row->height - (min_y - row->y);
-	  else if (row->y + row->height > max_y)
-	    row->visible_height
-	      = row->height - (row->y + row->height - max_y);
-	  else
-	    row->visible_height = row->height;
+	    row->visible_height -= min_y - row->y;
+	  if (row->y + row->height > max_y)
+	    row->visible_height -= row->y + row->height - max_y;
 	}
 
       /* Scroll the current matrix.  */
@@ -12246,7 +12249,7 @@
 
   if (FRAME_WINDOW_P (it->f))
     {
-      int i, header_line_height;
+      int i, min_y, max_y;
 
       /* The line may consist of one space only, that was added to
 	 place the cursor on it.  If so, the row's height hasn't been
@@ -12285,15 +12288,13 @@
       /* Compute how much of the line is visible.  */
       row->visible_height = row->height;
       
-      header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (it->w);
-      if (row->y < header_line_height)
-	row->visible_height -= header_line_height - row->y;
-      else
-	{
-	  int max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (it->w);
-	  if (row->y + row->height > max_y)
-	    row->visible_height -= row->y + row->height - max_y;
-	}
+      min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (it->w);
+      max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (it->w);
+
+      if (row->y < min_y)
+	row->visible_height -= min_y - row->y;
+      if (row->y + row->height > max_y)
+	row->visible_height -= row->y + row->height - max_y;
     }
   else
     {