Subject: bug#18923: Alternative scrolling model

From: Eli Zaretskii <[email-masked]>
Date: Mon, 03 Nov 2014 05:45:30 +0200

> Date: Sun, 02 Nov 2014 21:29:32 +0200
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > > I meant call window-body-height with PIXELWISE non-nil.  Then the
> > > return value doesn't depend on what is displayed, it just gives you
> > > the height of the text area in pixels.  Subtracting from that the
> > > pixel coordinates of point returned by pos-visible-in-window-p or
> > > posn-at-point will give you how many pixels are there to the top and
> > > bottom of the window.  This should eliminate the need to count pixels
> > > by moving one screen line at a time via vertical-motion, which is less
> > > efficient, I think.
> > 
> > I'm not sure how knowing the distance of a point to the bottom of the window would benefit me, but indeed I could bulk-measure several lines in some cases.
> 
> IMO the most important case is when you need to scroll almost the full
> window, in which case the pixel size of the window is the main piece
> of information.

In addition, you could change st-move to work in pixels instead of
lines.  Then you could use posn-at-x-y inside st-move to find the
position at a given Y offset from the current window-start, and move
the new window-start to that position.  This should eliminate the need
to use vertical-motion in st-move even if you need to scroll by one or
a few screen lines.  The conversion of the number of lines to pixels
is straightforward using default-line-height.