[Top][All Lists]

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

Re: Correct way to implement `pixel-point-and-height-at-unseen-line'?

From: Eli Zaretskii
Subject: Re: Correct way to implement `pixel-point-and-height-at-unseen-line'?
Date: Mon, 13 Dec 2021 16:32:48 +0200

> From: Po Lu <>
> Date: Mon, 13 Dec 2021 09:38:30 +0800
> I don't know how to make `pixel-point-and-height-at-unseen-line' work
> correctly: if I use `line-pixel-height', it will only report the height
> the first individual line inside a display string if there is one above
> window start, but if I use `window-text-pixel-size', I have to determine
> the region to measure, which is quite troublesome.
> For example, window start is often not the beginning of a visual line in
> Info buffers, so in order to measure the height of the previous line (or
> object), I have to find the beginning of the visual line at window
> start, and pass that as the `to' argument to window-text-pixel-size
> instead.
> This works okay until there is a `line-prefix' property at window start:
> in this case, window start is the beginning of a visual line, but it
> does not display at the beginning of the line, which means
> `window-text-pixel-size' will add the height of the current line to that
> of the previous line.  I will add a workaround to pixel-scroll.el, but
> there must be a cleaner way to implement this.

The correct way is to use window-text-pixel-size.  Whatever problems
that gives you in some corner use cases, we'd need to teach
window-text-pixel-size to handle those at least optionally.

And you didn't describe why do you need
pixel-point-and-height-at-unseen-line's data in the first place, so
maybe there's a different solution to whatever you are trying to do
that doesn't involve such a function.

reply via email to

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