GNU bug report logs -
#18923
Alternative scrolling model
Previous Next
Reported by: E Sabof <esabof <at> gmail.com>
Date: Sun, 2 Nov 2014 01:17:03 UTC
Severity: wishlist
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Eli Zaretskii <eliz <at> gnu.org> writes:
> > Imagine there is a buffer with **AN IMAGE** which occupies 30% of the window (ex. a diagram in an org-mode buffer). It's positioned at (window-start). I (scroll-up 1). I'd end up scrolling a lot more than the usual (= (default-line-height) 20) pixels, which is what I mean by "jump".
> If the problem is only with scrolling by single lines (or small
> number of lines), then a very similar problem is already solved in
> line-move-partial. Try C-n in the same situation, and see if that's
> what you want. We could then use the same technique.
I'm not sure that we are talking about the same scenario. I didn't encounter any relevant behavior while using C-n/C-p, when a large image was displayed on the first line (with my default settings or Emacs -Q, both on the latest stable release).
> The problem that you faced, as I understand it, was to get the pixel
> size of a screen line even if it is only partially visible. The RTOP
> and RBOT values returned by pos-visible-in-window-p give you
> information about how many pixels of the line are above the top and
> below the bottom of the window. (For a very tall image or a low
> window, both RTOP and RBOT will be non-zero.) Add those to the
> visible height of the line, and AFIU you get what you wanted. Am I
> missing something?
Maybe not.
>> > IME, the most important use case is scrolling by "almost the full
>> > window", in which case it is better to start with window-body-height
>> > and subtract from it, instead of starting with zero and add to it.
>> > The most expensive part here is vertical-motion, so I think you want
>> > to call it as little as possible.
>>
>> window-body-height can be very wrong if a large image is displayed in the buffer.
>
> 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.
Evgeni
This bug report was last modified 3 years and 90 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.