Subject: Re: bug#18195: 24.3.92; window-screen-lines is not accurate

From: Dmitry Gutov <[email-masked]>
Date: Tue, 05 Aug 2014 17:05:20 +0400

On 08/05/2014 04:20 PM, martin rudalics wrote:
>  > 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.

Suppose I do that. When do I convert any of the resulting values to 
number of lines?

Please remember, we're using an overlay for popup rendering. Overlays 
work with lines of text.

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

As above, we really don't need a pixel value in the end result. If the 
overlay is made to span over lines with different heights and lines 
spacing, we can either make it follow all those dimensions, or override 
them to the same values.

But while we can do that, ignoring the global value of line-spacing 
wouldn't be comfortable for users that have it set.

> 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.

See above.

By the way, `window-screen-lines' not being accurate doesn't seem to be 
directly caused by pixel-perfect positioning. If I copy the necessary 
definitions (the 3 new function) to Emacs 24.3, it exhibits the same 
problem.