count-screen-lines is a compiled Lisp function in `
(count-screen-lines &optional BEG END COUNT-FINAL-NEWLINE WINDOW)
Return the number of screen lines in the region.
The number of screen lines may be different from the number of actual lines,
due to line breaking, display table, etc.
Optional arguments BEG and END default to `point-min' and `point-max'
If region ends with a newline, ignore it unless optional third argument
COUNT-FINAL-NEWLINE is non-nil.
The optional fourth argument WINDOW specifies the window used for obtaining
parameters such as width, horizontal scrolling, and so on. The default is
to use the selected window's parameters.
Like `vertical-motion', `count-screen-lines' always uses the current buffer,
regardless of which buffer is displayed in WINDOW. This makes possible to use
`count-screen-lines' in any buffer, whether or not it is currently displayed
in some window.