diff src/dispnew.c @ 33603:6697403d3c12

(update_text_area): Fix last change.
author Gerd Moellmann <gerd@gnu.org>
date Sat, 18 Nov 2000 23:56:13 +0000
parents 680ddd4ab1f9
children fabc62c651a8
line wrap: on
line diff
--- a/src/dispnew.c	Sat Nov 18 21:07:10 2000 +0000
+++ b/src/dispnew.c	Sat Nov 18 23:56:13 2000 +0000
@@ -3996,7 +3996,7 @@
       
       while (i < stop)
 	{
-	  int skip_equal_glyphs_p = 1;
+	  int can_skip_p = 1;
 	  
 	  /* Skip over glyphs that both rows have in common.  These
 	     don't have to be written.  We can't skip if the last
@@ -4013,38 +4013,42 @@
 	      
 	      rif->get_glyph_overhangs (glyph, XFRAME (w->frame),
 					&left, &right);
-	      skip_equal_glyphs_p = right == 0;
+	      can_skip_p = right == 0;
 	    }
-
-	  if (skip_equal_glyphs_p)
-	    while (i < stop
-		   && GLYPH_EQUAL_P (desired_glyph, current_glyph))
-	      {
-		x += desired_glyph->pixel_width;
-		++desired_glyph, ++current_glyph, ++i;
-	      }
-
-	  /* Consider the case that the current row contains "xxx ppp
-	     ggg" in italic Courier font, and the desired row is "xxx
-	     ggg".  The character `p' has lbearing, `g' has not.  The
-	     loop above will stop in front of the first `p' in the
-	     current row.  If we would start writing glyphs there, we
-	     wouldn't erase the lbearing of the `p'.  The rest of the
-	     lbearing problem is then taken care of by x_draw_glyphs.  */
-	  if (overlapping_glyphs_p
-	      && i > 0
-	      && i < current_row->used[TEXT_AREA]
-	      && current_row->used[TEXT_AREA] != desired_row->used[TEXT_AREA])
+	  
+	  if (can_skip_p)
 	    {
-	      int left, right;
+	      while (i < stop
+		     && GLYPH_EQUAL_P (desired_glyph, current_glyph))
+		{
+		  x += desired_glyph->pixel_width;
+		  ++desired_glyph, ++current_glyph, ++i;
+		}
+
+	      /* Consider the case that the current row contains "xxx
+		 ppp ggg" in italic Courier font, and the desired row
+		 is "xxx ggg".  The character `p' has lbearing, `g'
+		 has not.  The loop above will stop in front of the
+		 first `p' in the current row.  If we would start
+		 writing glyphs there, we wouldn't erase the lbearing
+		 of the `p'.  The rest of the lbearing problem is then
+		 taken care of by x_draw_glyphs.  */
+	      if (overlapping_glyphs_p
+		  && i > 0
+		  && i < current_row->used[TEXT_AREA]
+		  && (current_row->used[TEXT_AREA]
+		      != desired_row->used[TEXT_AREA]))
+		{
+		  int left, right;
 	      
-	      rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame),
-					&left, &right);
-	      while (left > 0 && i > 0)
-		{
-		  --i, --desired_glyph, --current_glyph;
-		  x -= desired_glyph->pixel_width;
-		  left -= desired_glyph->pixel_width;
+		  rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame),
+					    &left, &right);
+		  while (left > 0 && i > 0)
+		    {
+		      --i, --desired_glyph, --current_glyph;
+		      x -= desired_glyph->pixel_width;
+		      left -= desired_glyph->pixel_width;
+		    }
 		}
 	    }
 	  
@@ -4057,15 +4061,18 @@
 	      int start_x = x, start_hpos = i;
 	      struct glyph *start = desired_glyph;
 	      int current_x = x;
-	      
+	      int skip_first_p = !can_skip_p;
+
 	      /* Find the next glyph that's equal again.  */
 	      while (i < stop
-		     && !GLYPH_EQUAL_P (desired_glyph, current_glyph)
+		     && (skip_first_p
+			 || !GLYPH_EQUAL_P (desired_glyph, current_glyph))
 		     && x == current_x)
 		{
 		  x += desired_glyph->pixel_width;
 		  current_x += current_glyph->pixel_width;
 		  ++desired_glyph, ++current_glyph, ++i;
+		  skip_first_p = 0;
 		}
 
 	      if (i == start_hpos || x != current_x)