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: Yuan Fu
Subject: Re: Set-window-vscroll sometimes doesn't work
Date: Tue, 20 Oct 2020 14:19:46 -0400

> 
> 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?

> 
>>> Indeed, that's not what we want.  Which is why scroll commands are not
>>> the right starting point for what you want to do.
>> 
>> Maybe I should state what I want to do clearly: I want to achieve the smooth 
>> scrolling when both scrolling and moving point, i.e., both scroll-up/down 
>> and next/previous-line, that ensures I never have annoying jumpy images.
> 
> 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.

> 
>> 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”?

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

Yuan




reply via email to

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