GNU bug report logs - #18195
24.3.92; window-screen-lines is not accurate

Previous Next

Package: emacs;

Reported by: Dmitry <dgutov <at> yandex.ru>

Date: Tue, 5 Aug 2014 02:01:01 UTC

Severity: normal

Found in version 24.3.92

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 18195 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Dmitry Gutov <dgutov <at> yandex.ru>, 18195 <at> debbugs.gnu.org
Subject: Re: bug#18195: 24.3.92; window-screen-lines is not accurate
Date: Tue, 05 Aug 2014 14:20:58 +0200
> It won't help to determine how much space is left below the current line if the current line is the last in the buffer but not in the window, right?

You have to calculate the height of the text from window start till the
end of the buffer and subtract the result from the window's text height.

>  > `window-text-height' with PIXELWISE t should give you the overall
>  > height of the window.
>
> `count-screen-lines' already helps with "space above the current line", and we can find out the total height of the window in pixels. So if I'm going to do the arithmetics myself, the one thing missing is the accurate value of the height of a line in the buffer.

`count-screen-lines' doesn't return a pixel value.  How do you get that
with lines of different heights and line spacing?

> How do I obtain it (let's consider it mostly-constant)?
>
>> If things like line spacing are involved you really should calculate
>> pixelwise.
>
> The docstring of `window-screen-lines' seems to claim that it's suitable. The implementation looks kinda right, too, but the result it returns is not accurate.

It again just returns a line value.  IIRC someone has set the font size
to 1 pixel to make this return something reasonable.  But why do all
these acrobatics?  `window-text-pixel-size' should give you everything
you need in a uniform way.  And if something's missing we can easily add
it.

martin




This bug report was last modified 10 years and 289 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.