--- Begin Message ---
Subject: |
29.0.50; fit-frame-to-buffer's window-text-pixel-size calculation can be incorrect when only is set to vertically |
Date: |
Sun, 19 Jun 2022 23:03:14 -0400 |
To repro, open emacs -Q and resize your frame so that the ";; This
buffer..." text wraps (this repro assumes your monitor has more than
enough space for it to not wrap if the frame was big enough).
Add a few more lines of text and then:
M-: (fit-frame-to-buffer nil nil nil nil nil 'vertically)
You should see that the frame's height is too short and does not contain
all the lines. It contains one fewer line for each wrapped line.
Screenshots:
https://share.cleanshot.com/huexHe
https://share.cleanshot.com/dnhKex
The problem appears to be the lines:
(size
(window-text-pixel-size window from to max-width max-height))
As the max-width will be larger than the current frame (meaning the
height calculation will not take wrapping into account).
One possible fix is to set min/max height/width based on `only' to
(frame-parameter frame 'width) / (frame-parameter frame 'height) but I
do not know if that is the best fix.
If that is done, then it may be possible to remove the rest of the
special handling for `only' that sets width/height to nil and handles that.
In GNU Emacs 29.0.50 (build 1, aarch64-apple-darwin21.5.0, NS appkit-2113.50
Version 12.4 (Build 21F79))
of 2022-05-30 built on aaron-m1.local
Windowing system distributor 'Apple', version 10.3.2113
System Description: macOS 12.4
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#56102: 29.0.50; fit-frame-to-buffer's window-text-pixel-size calculation can be incorrect when only is set to vertically |
Date: |
Wed, 6 Jul 2022 09:17:07 -0400 |
On Wed, Jul 6, 2022 at 3:37 AM martin rudalics <rudalics@gmx.at> wrote:
>
> > No issues to report. Has worked fine for me for the last week.
>
> Thanks. I've pushed these changes to master now. If there are any
> problems, please complain. Otherwise, consider marking this bug as
> done.
Great, thank you. Closing.
Aaron
--- End Message ---