bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38731: [PATCH] Calculate first glyph to be redrawn when exposing (bu


From: Alan Third
Subject: bug#38731: [PATCH] Calculate first glyph to be redrawn when exposing (bug#38731)
Date: Fri, 27 Dec 2019 16:26:20 +0000

* src/xdisp.c (expose_area): When the face extends to the end of the
line calculate the first glyph to be redrawn rather than assuming it
starts at the first glyph in the row.
---
src/xdisp.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 3080f8920a..42a86a1d12 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -33489,30 +33489,30 @@ expose_area (struct window *w, struct glyph_row *row, 
const Emacs_Rectangle *r,
   struct glyph *last;
   int first_x, start_x, x;
 
+  /* Set START_X to the window-relative start position for drawing glyphs of
+     AREA.  The first glyph of the text area can be partially visible.
+     The first glyphs of other areas cannot.  */
+  start_x = window_box_left_offset (w, area);
+  x = start_x;
+  if (area == TEXT_AREA)
+    x += row->x;
+
+  /* Find the first glyph that must be redrawn.  */
+  while (first < end
+         && x + first->pixel_width < r->x)
+    {
+      x += first->pixel_width;
+      ++first;
+    }
+
   if (area == TEXT_AREA && row->fill_line_p)
     /* If row extends face to end of line write the whole line.  */
-    draw_glyphs (w, 0, row, area,
-                0, row->used[area],
+    draw_glyphs (w, x - start_x, row, area,
+                first - row->glyphs[area], row->used[area],
                 DRAW_NORMAL_TEXT, 0);
   else
     {
-      /* Set START_X to the window-relative start position for drawing glyphs 
of
-        AREA.  The first glyph of the text area can be partially visible.
-        The first glyphs of other areas cannot.  */
-      start_x = window_box_left_offset (w, area);
-      x = start_x;
-      if (area == TEXT_AREA)
-       x += row->x;
-
-      /* Find the first glyph that must be redrawn.  */
-      while (first < end
-            && x + first->pixel_width < r->x)
-       {
-         x += first->pixel_width;
-         ++first;
-       }
-
-      /* Find the last one.  */
+      /* Find the last glyph to be redrawn.  */
       last = first;
       first_x = x;
       /* Use a signed int intermediate value to avoid catastrophic
-- 
2.24.0


-- 
Alan Third





reply via email to

[Prev in Thread] Current Thread [Next in Thread]