(redraw): Don't redraw an area where not text is
authorhanda <handa>
Mon, 12 Sep 2005 01:07:34 +0000 (01:07 +0000)
committerhanda <handa>
Mon, 12 Sep 2005 01:07:34 +0000 (01:07 +0000)
displayed.

example/medit.c

index 9cff321..cf7aa7c 100644 (file)
@@ -391,12 +391,17 @@ redraw (int y0, int y1, int clear, int scroll_bar)
   info.metrics.height = line->y1 - y;
   info.metrics.y = - line->ascent;
   info.line_to = line->to;
-  while (from < nchars && y + info.metrics.height <= y0)
+  while (y + info.metrics.height <= y0)
     {
       y += info.metrics.height;
       from = info.line_to;
+      if (from >= nchars)
+       break;
       GLYPH_INFO (from, from, info);
     }
+  if (y + info.metrics.height <= y0)
+    return;
+
   y0 = y - info.metrics.y;
   to = from;
   while (to < nchars && y < y1)