Subject: bug#72830: Big rectangular selections are slow

From: Eli Zaretskii <[email-masked]>
Date: Tue, 27 Aug 2024 22:16:58 +0300

> Cc: [email-masked], [email-masked], [email-masked]
> Date: Tue, 27 Aug 2024 20:47:18 +0300
> From: Eli Zaretskii <[email-masked]>
> 
> > But how do we know what the viewport will be in `rectangle--highlight-for-redisplay`? Since it is redisplay that determines window-start and window-end, and it hasn't run yet, this puts us in some kind of chicken-egg situation. Maybe it has to be done inside redisplay.
> 
> It has to be done with the display code, but does not have to be as
> part of redisplay.  We can use functions like vertical-motion,
> window-text-pixel-size, posn-at-point, and other similar APIs, which
> all employ display code that performs layout-related calculations
> without actually displaying anything.

Btw, the horizontal dimensions of the window are known in advance even
without calling the display code, and we could use posn-at-x-y to find
the buffer position that corresponds to the right edge of the window.
Isn't that what's needed to avoid highlighting the portions of text
that are outside of the viewport?