all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: netjune@outlook.com, 38731@debbugs.gnu.org
Subject: bug#38731: [PATCH] Calculate first glyph to be redrawn when exposing (bug#38731)
Date: Fri, 27 Dec 2019 16:26:20 +0000	[thread overview]
Message-ID: <20191227162620.GA92799@breton.holly.idiocy.org> (raw)
In-Reply-To: <20191227143500.GA75733@breton.holly.idiocy.org>

* 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	other threads:[~2019-12-27 16:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a0dc5800-db7e-4091-b385-e2c888f9472b@Spark>
2019-12-24 10:43 ` bug#38731: 27.0.50; Unexpected redisplay behaviour. Cursor can’t be moved to end of line HaiJun Zhang
2019-12-24 15:50   ` Eli Zaretskii
2019-12-24 16:42     ` HaiJun Zhang
2019-12-26 12:59     ` Alan Third
2019-12-26 13:24       ` HaiJun Zhang
2019-12-26 17:29       ` Eli Zaretskii
2019-12-27 14:35         ` Alan Third
2019-12-27 16:26           ` Alan Third [this message]
2019-12-27 17:17             ` bug#38731: [PATCH] Calculate first glyph to be redrawn when exposing (bug#38731) Eli Zaretskii
2019-12-27 19:06               ` Alan Third
2019-12-28  8:54                 ` Eli Zaretskii
2019-12-28 11:20                   ` Alan Third
2019-12-28 18:27                     ` Eli Zaretskii
2019-12-29 10:46                       ` Alan Third
2019-12-30  4:55                         ` HaiJun Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191227162620.GA92799@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=38731@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=netjune@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.