Subject: bug#78766: 100-4000x redisplay slowdown with vscroll>0 and make-cursor-line-fully-visible=t

From: JD Smith <[email-masked]>
Date: Mon, 16 Jun 2025 17:40:46 -0400

> On Jun 15, 2025, at 1:00 PM, Eli Zaretskii <[email-masked]> wrote:
>> if (MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P
>> (w, MATRIX_ROW (w->desired_matrix, w->cursor.vpos)))
>>   return SCROLLING_FAILED;
>> else
>>   goto too_near_end;
>> }
>>      rc = SCROLLING_SUCCESS;
>> 
>> I get no artifacts, and it seems to do what I'd expect — if you try to move point onto a partially visible top row, the window is recentered according to scroll-conservatively.
>> 
>> Seems to work normally with line-move and tall images.  I will run with it for a while to see if anything else appears.
> 
> If that works for you, it's fine by me.  I thought that recentering
> will effectively disable the effect of vscroll, and so assumed it will
> be unacceptable for your package.

Your instincts were good.  The patch was fine in almost all scenarios, but had problems for images taller than the window.  In this situation you have no choice but to keep point on a partially visible top line.  The inherent recentering negatively affects line-move across tall images, especially noticeable for multiple tall lines in a row.

If we use your top row test as enclosed, this seems to do what we want: avoid the long loop and resulting big slowdown, while permitting the cursor to fall on a partially visible top line.

Thanks for your efforts.

￼