From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.help Subject: Re: Set-window-vscroll sometimes doesn't work Date: Thu, 22 Oct 2020 12:50:23 -0400 Message-ID: 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> <83h7qnmtq4.fsf@gnu.org> <8C545387-7A95-4B4E-A71E-05949E8A4641@gmail.com> <183EE2A7-4FF5-4888-A6F5-BDE08BD5F482@gmail.com> <83imb2kzu0.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10372"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 22 18:51:47 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 1kVdoZ-0002Z7-Ci for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 22 Oct 2020 18:51:47 +0200 Original-Received: from localhost ([::1]:41156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVdoY-00053w-9H for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 22 Oct 2020 12:51:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVdnO-0004Hg-8T for help-gnu-emacs@gnu.org; Thu, 22 Oct 2020 12:50:35 -0400 Original-Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]:33600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVdnK-00087T-4g; Thu, 22 Oct 2020 12:50:33 -0400 Original-Received: by mail-qt1-x831.google.com with SMTP id j62so1619941qtd.0; Thu, 22 Oct 2020 09:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=/HWtyu79HUvFf32Oc33xDJbOt00if7noxF4bnXq2Zss=; b=WA4f7+9zDadnxR8UFT/p/gKgiiZIlFvLrPOm2KPYEai5sR9Xe9Ka17eaY62MTA8I5n Mz3wINmvbWRj1CrqdxXRkXxCNKQ0BVa4Jspy6m4wBImygQHr4SZ4Cc65uS6O7GKnqDwY neVT9JHAjAnKfX1fA2VJcj8wUzqyEvgSG7O+hN4BcFumoAH5B64cB9XVgmEOFMxHmaOV 7hD+BZTRq6oOecTy77G+Y57BYsWng6bp1qd+2pkAMgwIFOsF2VCwOyMZh1MhafWWzkJa 7ofdxLwYG9Xy6glyAUAbxNZpxXROMrACL65sgHnlWbvQv5g+wsPLhaPX6HrHhn1q0szf vIVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=/HWtyu79HUvFf32Oc33xDJbOt00if7noxF4bnXq2Zss=; b=qdmLp+eGSJ7rMJq+EhbNshV+MIcGHehkDUuMWXwSlTUVpFCy0iqVvyHk7t9os6IT5e tWcKoWIjemnx62fgL9uECduocKaIvHdyn4KLFGK2v7UVVJ6JimsGPBQ+xgKThDP/yqg+ Qit93WShOFN5Loye7Viz97mDr1RASWgoRjfEwri1M79Qei8NMItxZ+YDGa4HNmtTPm1z oKSZASQoSfNZl1wewvQg6lB4mEsItmAyvf62FKIMdApqI33ZMpNvIC+CJNU0oYLdvj+p vvdwa7heEZxAuzO0qhekXLzM5YlxNh34deWCCjZDSx5zzNwasnDJ3V9IBZ82/U4rbI87 jrLQ== X-Gm-Message-State: AOAM531VFklwvnOWTfzILsrIV2Yn8ywbgIT8yss1BlibF8iubcQSRSgQ AnFeOs/74UgmvSPRLlt/RMoPALfQFlZNHyASsbQ= X-Google-Smtp-Source: ABdhPJzxC9K99pXBKPozUvxnAtxYIzxidw6ae+k+BQPH6lI8CcbnT5a7kv+731ReulrY6qmCZNbHgg== X-Received: by 2002:ac8:1246:: with SMTP id g6mr2884627qtj.353.1603385425607; Thu, 22 Oct 2020 09:50:25 -0700 (PDT) Original-Received: from [192.168.1.10] (c-174-60-229-153.hsd1.pa.comcast.net. [174.60.229.153]) by smtp.gmail.com with ESMTPSA id z13sm1360683qkl.2.2020.10.22.09.50.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2020 09:50:24 -0700 (PDT) In-Reply-To: <83imb2kzu0.fsf@gnu.org> X-Mailer: Apple Mail (2.3608.120.23.2.4) Received-SPF: pass client-ip=2607:f8b0:4864:20::831; envelope-from=casouri@gmail.com; helo=mail-qt1-x831.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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:124637 Archived-At: > What do you mean by "smooth scrolling" here? If I invoke C-2 C-n" on > a large image, the image gets scrolled by the amount of pixels that is > equivalent to 2 screen lines. Isn't that what you see? With emacs -Q? On my machine emacs -Q doesn=E2=80=99t to that. Instead = of moving two line=E2=80=99s height, it just jumps to the next logical = line. > When vscroll is so large that the window-start point is entirely not > visible, you should move window-start so it becomes visible. But that > shouldn't be a problem, because it means you've scrolled the entire > image off-screen. > On Oct 22, 2020, at 12:08 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Thu, 22 Oct 2020 00:16:04 -0400 >> Cc: help-gnu-emacs@gnu.org >>=20 >> Ok, I looked at redisplay_window, and it zeros out vscroll if = force_start is true, that explains my initial >> question. After reading the function, it seems that setting = window-start is the primary way to scroll and to >> produce the glyph matrix to display. IIUC this is how window-start = and vscroll works together in window >> redisplay: we have a window-start -> try window -> start_display on = window-start -> it_initialize on >> window-start -> it->current-y adjusted according to vscroll -> back = to try window -> while (it.current_y < >> it.last_visible_y): produce glyph rows. This doesn=E2=80=99t seem to = be too contradictory, and scrolling by setting >> window-start and add sub-line adjustment with vscroll seems to be = complaint with the redisplay logic. What >> am I missing? >=20 > You are missing the use cases where the display element that is taller > than the normal text is not an image, but something else. For > example, text displayed with a very large font. In this other use > case, starting display with a non-zero vscroll when the Lisp program > forced window-start will produce text part of which cannot be read, > because too much of the characters is off-screen. >=20 > This is why setting window-start zeroes out vscroll: Emacs wants to > make sure that in this case the entire screen line that starts at > window-start will be fully visible. >=20 That=E2=80=99s a fair point. But what about scrolling down into an = image? I=E2=80=99ll need to set window-start on the image then set = vscroll to image height - line height so it only displays the bottom = strip. That=E2=80=99s what line-move does, too: (prog1 (line-move-visual arg noerror) ;; If we moved into a tall line, set vscroll to make ;; scrolling through tall images more smooth. (let ((lh (line-pixel-height)) (edges (window-inside-pixel-edges)) (dlh (default-line-height)) winh) (setq winh (- (nth 3 edges) (nth 1 edges) 1)) (if (and (< arg 0) (< (point) (window-start)) (> lh winh)) (set-window-vscroll nil (- lh dlh) t)))) Yuan=