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

From: martin rudalics <[email-masked]>
Date: Tue, 05 Aug 2014 15:50:34 +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.
 >
 > Suppose I do that. When do I convert any of the resulting values to number of lines?

IIUC you want to check whether some text of pixel height O would fit
into the rest of a window with pixel height W when the upper part of
that window is occupied by text with pixel height T.  So if O <= W - T
holds, you can put the overlay below the current line, and do something
else otherwise.  Why would you ever want to convert a resulting value to
a number of lines?

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

Overlays don't know about newlines.  I suppose the overlay starts at the
beginning of some line after text T and has as many characters as there
are in the text with height O.  If you want to cover any text with the
overlay do that.

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

IIUC you neither need pixels nor lines in the end result.  You just want
to know whether a given overlay fits into a given window at a given
position.

martin