[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: |
Sun, 18 Oct 2020 13:51:14 -0400 |
> On Oct 18, 2020, at 1:31 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sun, 18 Oct 2020 13:24:25 -0400
>> Cc: help-gnu-emacs@gnu.org
>>
>> No. The problem is in your code. First, you use set-window-start and
>> scroll-down, both of which tramp window-vscroll (as you probably
>> realize if you think about what those do).
>>
>> Why is so? Is there any material that I can read about these?
>
> These two functions force Emacs to display the buffer starting at a
> particular position, so vscroll is zeroed out. Otherwise, how could
> Emacs obey the forced start point?
>
>> This works, but brings flickers: the image first shows completely then the
>> vscroll takes effect, which is
>> reasonable but not preferred.
>
> It was just an example to explain to you what should be done. E.g.,
> when you scroll a tall image with C-n there's no flickering. You just
> cannot mix vscroll with other code that affects the window display,
> that's all.
>
>> I found that using (set-window-start nil (point) t) with the third argument
>> non-nil
>> gives me the desired effect. My guess is that, as the doctoring said,
>> setting that to non-nil prevents redisplay
>> to try to make point completely visible, so redisplay doesn’t modify
>> vscroll, so my vscroll value survived. Is
>> that right?
>
> NOFORCE non-nil means Emacs doesn't have to display the window
> starting at the position if there are valid reasons, so yes. But my
> suggestion is not to use set-window-start when you want to vscroll,
> it's unsafe. You in effect create a conflict for the display engine,
> and have no control on how it will resolve that conflict.
Thanks. I see what you mean. What I want to do is to scroll over images as if
it is made of several lines (like sliced images). Which requires scrolling over
logical lines by set-window-start and scrolling over images by
set-window-vscroll. Do you think I would be better off implementing this in,
say, window_scroll_pixel_based rather than in Lisp?
Yuan
- Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/17
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work,
Yuan Fu <=
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/18
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/19
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/19
- Re: Set-window-vscroll sometimes doesn't work, Eli Zaretskii, 2020/10/19
- Re: Set-window-vscroll sometimes doesn't work, Yuan Fu, 2020/10/19