Subject: bug#32932: 27.0.50; render bugs on macOS Mojave

From: Aaron Jensen <[email-masked]>
Date: Thu, 1 Nov 2018 12:52:43 -0700

On November 1, 2018 at 11:12:14 AM, Eli Zaretskii
([email-masked](mailto:[email-masked])) wrote:

> Can you find the reason for that? In general, redrawing the cursor
> should only redraw a single character, and sometimes the two adjacent
> ones. It shouldn't redraw more than that.
>
> From what you describe, it sounds like the problem is in the logic
> that determines which parts to redraw, see update_text_area in
> dispnew.c.

dispnew.c redraws up to the end of the line in many situations. I
added the following logging:

      fprintf (stderr, "clear %d %d %d %d %d %d %d\n", !current_row->enabled_p
               , desired_row->y != current_row->y
               , desired_row->ascent != current_row->ascent
               , desired_row->phys_ascent != current_row->phys_ascent
               , desired_row->phys_height != current_row->phys_height
               , desired_row->visible_height != current_row->visible_height
               , current_row->overlapped_p);
      fprintf (stderr, "desired\t%d\t%d\t%d\t%d\t%d\n"
               , desired_row->y
               , desired_row->ascent
               , desired_row->phys_ascent
               , desired_row->phys_height
               , desired_row->visible_height);
      fprintf (stderr, "current\t%d\t%d\t%d\t%d\t%d\n"
               , current_row->y
               , current_row->ascent
               , current_row->phys_ascent
               , current_row->phys_height
               , current_row->visible_height);

And when this happens, this is what I get:

draw_glyphs x: 56 pos: 7 8
clear 0 0 1 1 1 0 0
desired 0       15      12      16      19
current 0       0       0       19      19
clear 1 0 0 0 0 0 0
desired 637     20      19      26      28
current 637     20      19      26      28
clear 1 0 1 1 1 1 0
desired 0       318     318     637     637
current 0       15      15      19      19
clear 1 0 0 0 0 0 0
desired 0       15      12      16      19
current 0       15      12      16      19

So, the ascent and physics_ascent on the current row are coming back
as 0. Also, the height is different.

That’s causing it to redraw to the end of the line.

AFAICT there are two issues:

1. It’s redrawing to the end of the line unnecessarily.
2. It’s clearing and then doing some other processing before actually painting.

If #1 was fixed, it would perhaps be better, but I wonder if the area
under the cursor would be cleared the same.

I tried changing the condition in update_text_area to just:

if (!current_row->enabled_p)

And it still reproduced, so the ascent stuff above may be a red herring…

Aaron