unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43105: (window-body-height) Reporting Too Large of Value
@ 2020-08-29 17:10 William Carroll
  2020-08-29 18:37 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: William Carroll @ 2020-08-29 17:10 UTC (permalink / raw)
  To: 43105

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]

I believe `(window-body-height)` does not account for non-zero
`line-spacing` amounts. This causes `(window-body-height)` in graphical
Emacs to report values larger than the number of lines of text that can
render on the screen.

This affects programs like vterm.el and others that rely on
`(window-body-height)`. In my particular case, when I ran `man` and `less`
from vterm.el, it rendered things above the top "fold" of the screen.

When I tried to reproduce these issues with `emacs -nw`, everything was
fine. I imagine this is because `emacs -nw` disregards `line-spacing`.

I'm happy to share more information to help someone reproduce this issue.

[-- Attachment #2: Type: text/html, Size: 763 bytes --]

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

* bug#43105: (window-body-height) Reporting Too Large of Value
  2020-08-29 17:10 bug#43105: (window-body-height) Reporting Too Large of Value William Carroll
@ 2020-08-29 18:37 ` Eli Zaretskii
  2020-09-01 14:29   ` Stefan Kangas
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2020-08-29 18:37 UTC (permalink / raw)
  To: William Carroll; +Cc: 43105

> From: William Carroll <wpcarro@gmail.com>
> Date: Sat, 29 Aug 2020 18:10:17 +0100
> 
> I believe `(window-body-height)` does not account for non-zero `line-spacing` amounts. This causes
> `(window-body-height)` in graphical Emacs to report values larger than the number of lines of text that can
> render on the screen.

window-body-height reports the height of the window's body in units of
canonical character height:

  If PIXELWISE is nil, return the largest integer smaller than WINDOW’s
  pixel height divided by the character height of WINDOW’s frame.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Thus, window-body-height is by design insensitive to factors like
non-default fonts, line-spacing, etc.

> This affects programs like vterm.el and others that rely on `(window-body-height)`. In my particular case,
> when I ran `man` and `less` from vterm.el, it rendered things above the top "fold" of the screen.

Then the bug is in vterm.el: it should use other APIs to get the
dimensions in terms of actual number of lines in the window.  The
function window-body-height works as intended.

Thanks.





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

* bug#43105: (window-body-height) Reporting Too Large of Value
  2020-08-29 18:37 ` Eli Zaretskii
@ 2020-09-01 14:29   ` Stefan Kangas
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Kangas @ 2020-09-01 14:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: William Carroll, 43105

tags 43105 notabug
close 43105
thanks

Eli Zaretskii <eliz@gnu.org> writes:

>> From: William Carroll <wpcarro@gmail.com>
>> Date: Sat, 29 Aug 2020 18:10:17 +0100
>>
>> I believe `(window-body-height)` does not account for non-zero `line-spacing` amounts. This causes
>> `(window-body-height)` in graphical Emacs to report values larger than the number of lines of text that can
>> render on the screen.
>
> window-body-height reports the height of the window's body in units of
> canonical character height:
>
>   If PIXELWISE is nil, return the largest integer smaller than WINDOW’s
>   pixel height divided by the character height of WINDOW’s frame.
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Thus, window-body-height is by design insensitive to factors like
> non-default fonts, line-spacing, etc.
>
>> This affects programs like vterm.el and others that rely on `(window-body-height)`. In my particular case,
>> when I ran `man` and `less` from vterm.el, it rendered things above the top "fold" of the screen.
>
> Then the bug is in vterm.el: it should use other APIs to get the
> dimensions in terms of actual number of lines in the window.  The
> function window-body-height works as intended.

I'm therefore closing this bug report.





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

end of thread, other threads:[~2020-09-01 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-29 17:10 bug#43105: (window-body-height) Reporting Too Large of Value William Carroll
2020-08-29 18:37 ` Eli Zaretskii
2020-09-01 14:29   ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).