[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#54894: 28.1; window-body-height returns wrong result if line-spacing
From: |
martin rudalics |
Subject: |
bug#54894: 28.1; window-body-height returns wrong result if line-spacing is non-nil |
Date: |
Wed, 13 Apr 2022 10:47:05 +0200 |
> Help for window-body-height says:
> (window-body-height &optional WINDOW PIXELWISE)
>
> Return the height of WINDOW’s text area.
> WINDOW must be a live window and defaults to the selected one. Optional
> argument PIXELWISE non-nil means return the height of WINDOW’s text area
> in pixels. The return value does not include the mode line or header
> line or any horizontal divider.
>
> If PIXELWISE is nil, return the largest integer smaller than WINDOW’s
> pixel height divided by the character height of WINDOW’s frame. This
> means that if a line at the bottom of the text area is only partially
> visible, that line is not counted.
> ----------
>
> It seems the case with PIXELWISE being nil is not handled correctly when
> line-spacing is non-nil.
Line-spacing does not affect the "character height of WINDOW’s frame".
I have made local changes here that describe that function as follows:
-- Function: window-body-height &optional window pixelwise
This function returns the height of WINDOW’s body. WINDOW must be
a live window and defaults to the selected one.
If the optional argument PIXELWISE is non-‘nil’, this function
returns the height of WINDOW’s body in pixels—the body pixel height
of WINDOW.
If PIXELWISE is ‘nil’, the return value depends on the current
value of ‘window-scale-body’ (*note Window Character Size::) as
follows:
• If ‘window-scale-body’ is ‘nil’, this function returns the
largest integer smaller than WINDOW’s body pixel height
divided by the character height of WINDOW’s frame.
• If ‘window-scale-body’ is ‘t’, it returns the largest integer
smaller than WINDOW’s body pixel height divided by WINDOW’s
character height.
• If ‘window-scale-body’ is the symbol ‘spaced’, it returns the
largest integer smaller than WINDOW’s body pixel height
divided by WINDOW’s spaced character height.
If PIXELWISE is non-‘nil’, the return value is always rounded down
to the nearest integer, if necessary. This means that if a line at
the bottom of the text area is only partially visible, that line is
not counted. It also means that if ‘window-scale-body’ is ‘nil’,
the value returned by this function can never exceed the value
returned by ‘window-total-height’ for WINDOW.
martin