emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Add function window-line-width


From: Sébastien Chapuis
Subject: Re: [PATCH] Add function window-line-width
Date: Mon, 11 Nov 2019 03:02:23 +0800

> There's always the problem that we want to reserve space for a block
> cursor at line end.

IMO that's a case that should be handled by the user of the function, not by 'window-lines-pixel-dimensions' itself.
In my few tests, 'window-lines-pixel-dimensions' returns a width with 1 and 2 glyphs more, so it's not just 1 space for the block cursor,
there might be cases where there are more glyphs added (?).
And AFAIK, there is no way to know how many glyphs/pixels the redisplay add.
Anyone who wants to have an accurate number of pixels displayed will be unable to use this function.

> Then we probably should rewrite 'window-text-pixel-size' as Eli
> suggested earlier.

Agreed, but I would prefer to use 'window-lines-pixel-dimensions' since this is exactly the function I need.
As per the documentation [1]:
`window-text-pixel-size treats the text displayed in a window as a whole and does not care about
 the size of individual lines. The following function [window-lines-pixel-dimensions] does.`

[1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Size-of-Displayed-Text.html#Size-of-Displayed-Text

Thanks,
Sebastien Chapuis.


Le dim. 10 nov. 2019 à 17:46, martin rudalics <address@hidden> a écrit :
 > A line with X characters should have the width of all thoses characters.
 > I see that 'window-largest-empty-rectangle' uses this function, the widths
 > of the rectangles it returns are smaller than they really are.

There's always the problem that we want to reserve space for a block
cursor at line end.

 > I tested the following code:
[...]
 > `(time (test1))` returns 0.000004869
 > `(time (test2))` returns 0.00376

Then we probably should rewrite 'window-text-pixel-size' as Eli
suggested earlier.

martin

reply via email to

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