emacs-devel
[Top][All Lists]
Advanced

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

Re: move_it_vertically_backward question


From: Eli Zaretskii
Subject: Re: move_it_vertically_backward question
Date: Wed, 15 Dec 2021 16:50:08 +0200

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Wed, 15 Dec 2021 21:38:14 +0800
> 
> The requirement is basically to find the start of a line that is at
> least above window start by a given number of pixels, and to also find
> the vertical distance between the top of that line and the start of the
> window.
> 
> For instance, if we're scrolling upwards (upwards in this context is
> opposite to the terminology we use for line-based scrolling: it means
> moving the display downwards, like scroll-down) by 17 pixels, and there
> are two lines each 14 pixels in height above window start, the new
> window start will be set to the start position of the second line above
> window start (which this function should return), and vscroll will be
> set to 7 (which is 24 - 17, where the 24 is the aformentioned vertical
> distance that this function should also return).

We have code in the display engine that does this in several places.
For example, look at what we do when we recenter the window in
redisplay_window.  We could factor that code out of there, put it in a
separate function, and teach window-text-pixel-size to find the FROM
position using that new function.  Then the value of the TO argument
for window-text-pixel-size is of course well known, and you could run
the rest of the function to provide you with the pixel dimensions of
the text in-between.

Would that fit the bill?



reply via email to

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