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

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

bug#56102: 29.0.50; fit-frame-to-buffer's window-text-pixel-size calcula


From: martin rudalics
Subject: 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: Sun, 26 Jun 2022 12:09:25 +0200

> If I say that I only want it to scale vertically, I would
> expect no width changes to occur, which means I would expect that
> max-width and anything else width related would not be relevant.

Sounds reasonable.

> My concern was this:
>
>> Also, the sizes of frame and window decorations would hardly match.
>
> Effectively, that there would be some subtle difference between using
> (frame-parameter frame 'width) as MAX-WIDTH and passing nil to
> window-text-pixel-size window.

I was wrong earlier.  The doc-string of 'fit-frame-to-buffer' says that

  MAX-HEIGHT, MIN-HEIGHT, MAX-WIDTH and MIN-WIDTH specify bounds on
  the new total size of FRAME’s root window.

But actually it is the _body_ size of FRAME's root window the current
code constrains.  Incidentally, the default body width of a live root
window equals the value of FRAME's width parameter (the native width of
the frame minus the widths of the internal border, the scroll bar and
the fringes) which makes your fix work.  With a non-standard setup, say
after doing

(set-window-margins nil 10 10)

in the root window, your fix will fail with the scenario you provided
earlier.

We could try the following: If the new diff I attach now works for you,
I'll push it to master.  If after some period of grace (whose length you
determine) I manage to come up with a reasonable fix, I'll push that to
master too and you and your clients will have to adapt.  WDYT?

martin

Attachment: fit-frame-to-buffer.diff
Description: Text Data


reply via email to

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