[Top][All Lists]

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

Re: Redisplay resets vscroll when window start changes

From: Eli Zaretskii
Subject: Re: Redisplay resets vscroll when window start changes
Date: Mon, 15 Nov 2021 16:18:16 +0200

> From: Po Lu <luangruo@yahoo.com>
> Date: Mon, 15 Nov 2021 20:39:50 +0800
> I was implementing pixel-based scrolling based on XInput 2 pixel scroll
> events earlier, and i noticed this line in xdisp.c:
>  /* Handle case where place to start displaying has been specified,
>     unless the specified location is outside the accessible range.  */
>   if (w->force_start)
>     {
>       /* We set this later on if we have to adjust point.  */
>       int new_vpos = -1;
>       w->force_start = false;
> -->   w->vscroll = 0;
>       w->window_end_valid = false;
> It resets the vscroll whenever window start changes, which is annoying
> if you, for example, recenter the window during pixel scroll.

Yes.  This is the basis of how scrolling commands work in Emacs: they
set the window-start point.  When that happens, vscroll must be reset.

> Is it OK to control whether or not the vscroll is reset there based on a
> variable or a window parameter?  It would be very convenient to have
> such a feature.

That'd open a Pandora box of endless hacks and bug reports, so I'd
prefer not to allow that.  It is not how the present display code was
designed.  Forcing window-start and setting vscroll contradict each
other, because forcing window-start means we want the user to see the
stuff at that buffer position.

Are you using scroll commands to implement this?  If so, don't: they
are not the right way of having pixel-wise scrolling in Emacs.
Instead, scroll the display by controlling the non-zero vscroll,
without forcing window-start.

reply via email to

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