help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set-window-vscroll sometimes doesn't work


From: Eli Zaretskii
Subject: Re: Set-window-vscroll sometimes doesn't work
Date: Wed, 21 Oct 2020 19:25:39 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Tue, 20 Oct 2020 14:19:46 -0400
> Cc: help-gnu-emacs@gnu.org
> 
> > You could write a function that scrolls by 1 screen line, either by
> > scroll-up/down or with vscroll, then call that function 3 times, and
> > let it do its job each of these 3 times.  Then you'd still be able to
> > reuse most of the code that already exists, by following the same
> > convention: either scroll-up/down or set vscroll.
> 
> So that’s conceptually equivalent of inserting normal redisplays in between 
> set-window-start and set-window-vscroll, right?

I don't understand what you mean.  If you mean that you need to insert
sit-for, then no: try "C-u 10 C-n" when displaying a tall image, and
you will see that it scrolls the image by 10 screen lines.

> > Once again: scroll-up/down normally scroll by whole window, or by its
> > large fraction.  It is not a good idea to mix that with pixel-wise
> > scrolling of images.
> 
> AFAICT mouse wheel scrolling uses scroll-up/down, so a smooth scrolling 
> behavior for scroll-up/down is not unreasonable.

Mouse-wheel scrolling doesn't set window-start, it sets vscroll
instead.  So you indeed can use that paradigm as well, as long as you
make sure the argument to scroll-up/down is a small number.

But my point was that you shouldn't set window-start if you need to
use a non-zero vscroll.

> >> With my limited knowledge, setting window-start (aka scroll) and setting 
> >> vscroll in the same time is the only way to to get what I want. But it is 
> >> against the design of the display engine. Is there anyway out of this?
> > 
> > Not without rewriting significant parts of the display code.  Forcing
> > window-start and setting vscroll conceptually contradict each other,
> > so your interpretation of avoiding the contradiction by doing one and
> > then the other is bound to cause problems in other use cases.
> 
> I’d love to know more about this part. For me, window-start and vscroll seem 
> to be unrelated: changing vscroll doesn’t really affect window-start. 
> Couldn’t the redisplay do something like “move window to start at 
> window-start then scroll down vscroll pixels”?

The idea behind the current design is that if you set window-start,
you want to see the stuff at that position in its entirety.  Having
non-zero vscroll would prevent that, because some of the tall image is
not visible.

It is, of course, possible to use some other concept, but the current
concept is assumed in several places, and you will have to change them
all.

> > That is why I suggest to stick to the code in simple.el as much as
> > possible: it is well tested and works, AFAIU you need to change it
> > very little to be able to scroll images that are smaller than the
> > window height -- that test is in a small number of places and can be
> > replaced by something else.
> > 
> 
> next-line and friends only vscroll when scroll-conservatively=0 and ARG=1, 
> which allows it to get away from the problem I face (set-window-start and 
> set-window-vscroll in the same time). I either implements smooth scrolling to 
> only work when ARG=1 or I need to set both value at the same time.

I don't understand why you say this.  First, C-n works on tall images
with arguments greater than 1.  And second, I still don't understand
why you need to set window-start, because vscroll should be enough for
your needs, as far as I understand.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]