* window-height but taking the face into account
@ 2024-03-25 16:13 mbork
2024-03-25 16:57 ` Eli Zaretskii
2024-03-26 13:48 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 3+ messages in thread
From: mbork @ 2024-03-25 16:13 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
Hi all,
it seems that `window-height' returns the same number irrespective of
the font size I use (set up with `text-scale-adjust'). Is it possible
to get the actual number of lines visible on the screen? And yes, I am
aware that when different parts have different font sizes, it can get
messy etc., but I don't care about such issues -- I just want to know
how many lines are actually visible in the current window.
I think I could use something like
(floor (window-pixel-height) (window-default-line-height)).
Is there a better way?
TIA,
--
Marcin Borkowski
https://mbork.pl
https://crimsonelevendelightpetrichor.net/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: window-height but taking the face into account
2024-03-25 16:13 window-height but taking the face into account mbork
@ 2024-03-25 16:57 ` Eli Zaretskii
2024-03-26 13:48 ` Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2024-03-25 16:57 UTC (permalink / raw)
To: help-gnu-emacs
> From: mbork@mbork.pl
> Date: Mon, 25 Mar 2024 17:13:38 +0100
>
> it seems that `window-height' returns the same number irrespective of
> the font size I use (set up with `text-scale-adjust').
Yes. Like all the window-dimension functions, it measures in units of
canonical character height, which is the height of the frame's default
face's font.
> Is it possible to get the actual number of lines visible on the
> screen?
I'd say use line-number-at for the first and the last position in the
window, then subtract the first from the last.
> I think I could use something like
> (floor (window-pixel-height) (window-default-line-height)).
This will only be correct if all the lines in the window have the same
height.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: window-height but taking the face into account
2024-03-25 16:13 window-height but taking the face into account mbork
2024-03-25 16:57 ` Eli Zaretskii
@ 2024-03-26 13:48 ` Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-03-26 13:48 UTC (permalink / raw)
To: help-gnu-emacs
> messy etc., but I don't care about such issues -- I just want to know
> how many lines are actually visible in the current window.
(count-lines (window-start) (window-end))?
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-26 13:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 16:13 window-height but taking the face into account mbork
2024-03-25 16:57 ` Eli Zaretskii
2024-03-26 13:48 ` Stefan Monnier via Users list for the GNU Emacs text editor
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.