bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#51995: 29.0.50; `string-pixel-width' depends on the current window w


From: martin rudalics
Subject: bug#51995: 29.0.50; `string-pixel-width' depends on the current window width
Date: Sun, 21 Nov 2021 10:12:40 +0100

> I saw the warnings, but I'm unsure of their validity.
> Here are some benchmarks that I did.  Each form was run on a fresh emacs -Q.
> Apologies in advance if there is something wrong about them:
[...]
> (benchmark-run 100000
>    (with-temp-buffer
>      (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
eiusmod tempor incididunt ut labore et dolore")
>      (car (window-text-pixel-size
>            (current-buffer) (point-min) (point) 1000000))))
> ;; (8.006855 167 2.318854)
>
> It's a lot more efficient to use a buffer, but the difference
> between the limits themselves continue to be insignificant.

These examples are harmless.  Please try to test (1) with a large buffer
that has no newline characters and (2) with 'truncate-lines' non-nil.
'window-text-pixel-size' must be able to handle these cases gracefully
even if it's not geared to them.

Any clients of 'window-text-pixel-size' like 'string-pixel-width' can
easily set X-LIMIT to some sufficiently large value without affecting
the basic functionality of 'window-text-pixel-size'.

>> I hopefully fixed most of the issues here but cannot send you a patch at
>> the moment to test because my local copy is completely out of synch with
>> master.  So please bear with me.

Please try the attached patch (if it doesn't apply, I'll send you the
affected functions separately so you can apply the changes manually).

Thanks, martin

Attachment: buffer-text-pixel-size.diff
Description: Text Data


reply via email to

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