all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#56102: 29.0.50; fit-frame-to-buffer's window-text-pixel-size calculation can be incorrect when only is set to vertically
@ 2022-06-20  3:03 Aaron Jensen
  2022-06-22 13:58 ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Aaron Jensen @ 2022-06-20  3:03 UTC (permalink / raw)
  To: 56102


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






^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-07-06 13:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-20  3:03 bug#56102: 29.0.50; fit-frame-to-buffer's window-text-pixel-size calculation can be incorrect when only is set to vertically Aaron Jensen
2022-06-22 13:58 ` Eli Zaretskii
2022-06-22 14:15   ` Aaron Jensen
2022-06-23  7:30     ` martin rudalics
2022-06-24  2:28       ` Aaron Jensen
2022-06-24  9:20         ` martin rudalics
2022-06-24 14:28           ` Aaron Jensen
2022-06-26 10:09             ` martin rudalics
2022-06-26 13:12               ` Aaron Jensen
2022-06-27  8:24                 ` martin rudalics
2022-06-27 13:24                   ` Aaron Jensen
2022-06-28  9:29                     ` martin rudalics
2022-06-28 14:52                       ` Aaron Jensen
2022-07-05 13:07                         ` Aaron Jensen
2022-07-06  7:37                           ` martin rudalics
2022-07-06 13:17                             ` Aaron Jensen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.