From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Set-window-vscroll sometimes doesn't work Date: Wed, 21 Oct 2020 19:25:39 +0300 Message-ID: <83h7qnmtq4.fsf@gnu.org> References: <72B62847-3F35-412A-9F74-88442A936B19@gmail.com> <83eelvsivm.fsf@gnu.org> <853C8CD1-B58B-4F22-A889-4AB2AEE3DD80@gmail.com> <83imb7qw46.fsf@gnu.org> <66013ADF-731C-4922-8AF7-EAFDBF43C33C@gmail.com> <83ft6bqv0q.fsf@gnu.org> <4F2C1811-940E-4C58-8EE0-37AA3B666E12@gmail.com> <835z77qr3f.fsf@gnu.org> <834kmrq7gy.fsf@gnu.org> <83blgyp4k2.fsf@gnu.org> <4F794407-585E-4C74-85F3-00A668FB9675@gmail.com> <834kmqp1ts.fsf@gnu.org> <835z74ope5.fsf@gnu.org> <1B858755-4CAE-4E06-B867-098B323EF79E@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17054"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 21 18:26:09 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVGwD-0004Jw-9K for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 18:26:09 +0200 Original-Received: from localhost ([::1]:56778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVGwC-00017x-3A for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 12:26:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVGvZ-00016z-T5 for help-gnu-emacs@gnu.org; Wed, 21 Oct 2020 12:25:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52630) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVGvZ-0004Z3-Jr for help-gnu-emacs@gnu.org; Wed, 21 Oct 2020 12:25:29 -0400 Original-Received: from [176.228.60.248] (port=1259 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kVGvY-0003gE-6J for help-gnu-emacs@gnu.org; Wed, 21 Oct 2020 12:25:29 -0400 In-Reply-To: <1B858755-4CAE-4E06-B867-098B323EF79E@gmail.com> (message from Yuan Fu on Tue, 20 Oct 2020 14:19:46 -0400) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124624 Archived-At: > From: Yuan Fu > 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.