From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65214: 29.1; Tall images in 'image-mode' can't be scrolled with 'pixel-scroll-precision-mode' on Date: Sat, 12 Aug 2023 15:25:00 +0800 Message-ID: <87cyzspvsj.fsf@yahoo.com> References: <87il9mddcx.fsf@zohomail.eu> <875y5ld55b.fsf@zohomail.eu> <871qg9d4mp.fsf@zohomail.eu> <87pm3tov80.fsf@yahoo.com> <875y5kn3zq.fsf@zohomail.eu> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37214"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65214@debbugs.gnu.org To: Rahguzar Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 12 09:26:23 2023 Return-path: Envelope-to: geb-bug-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 1qUj0v-0009Rj-I6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Aug 2023 09:26:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUj0e-0004U0-FC; Sat, 12 Aug 2023 03:26:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUj0c-0004Ts-O7 for bug-gnu-emacs@gnu.org; Sat, 12 Aug 2023 03:26:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qUj0c-0004ok-Fb for bug-gnu-emacs@gnu.org; Sat, 12 Aug 2023 03:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qUj0c-0004vT-Aa for bug-gnu-emacs@gnu.org; Sat, 12 Aug 2023 03:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Aug 2023 07:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65214 X-GNU-PR-Package: emacs Original-Received: via spool by 65214-submit@debbugs.gnu.org id=B65214.169182511918853 (code B ref 65214); Sat, 12 Aug 2023 07:26:02 +0000 Original-Received: (at 65214) by debbugs.gnu.org; 12 Aug 2023 07:25:19 +0000 Original-Received: from localhost ([127.0.0.1]:48637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUizv-0004u1-6l for submit@debbugs.gnu.org; Sat, 12 Aug 2023 03:25:19 -0400 Original-Received: from sonic305-20.consmr.mail.ne1.yahoo.com ([66.163.185.146]:41919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUizs-0004tk-ED for 65214@debbugs.gnu.org; Sat, 12 Aug 2023 03:25:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1691825110; bh=GCicvgiAHkfS/VZ2LPT3vhhIjKxVjP3wUtnY57tWbTw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=KZ8fMme9vgWX61TPVPax3ui5QenK+UJxRAIPp+B9s0TZ/6AcRM55s7uP2ACcU/HsPLDaV1Yqh0+ZJoTcjP9P/TcotGyS404BaZcUaKXqWGIDilpHJUawKMk3iWuLDUB0ftaadRePbxx6yf3VESFaBUrcTuUc6mWpDMUoYg0wrwlMGQjbNQCQUu/X+RhUguxlsHboKew1tUDXUJ6O+do1p9qgDwXxSHND4JshbudxjfQOt2dHotT6oD5X2YMCu9pG2d5boxAEJc2pDUW1BciIHXrEDYY2uLThm50yqsghLuNQkWjYnTQYgvaYXPg6BUgV1JHe/FidPKrxuqQsrz2PEA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1691825110; bh=gT/21ZlbK6xtneUW+ZdwGxXSNdpGbRTiIzqxcTteh2E=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=mg9BXu/OdtcLPVmLP9LuaBrYwRGfZNumiaqMHDBHeoR7TzZCXfIqQJt3cIsM30WNJ04ZiRzciWJkw8couQ6FhV+C7KUl1gIXffY8PwQqpM+Gvozrp2VwaFFaiXUMMKNwB6kj6LL4PhJHZc90+X4y1y/pkHkUv5LU76YB4l4inWjsLJu8+p5i3XIey/65B6aS2ceKrMtYItXePZb3PK0/LNF1fjNwBlxgUz7338AU4MPMacZIfsf61kam669W7D0bxIQWISyldW4B88PppesE4qgyQa6Zu2sYKm7+MQ5WMs13j3Vw2kejk6YL5VWGtiZ5LarbanF3zt8eZhRoDEvrFQ== X-YMail-OSG: yC1Q284VM1kE943m9tPf5q6COgXdbsj3ymZ8il2vBCjglchJvdgWcjaRcZ3WPB1 JMWrP70VeGWwpvFGAFlgQXUF_P79q3f4tcZyDbMPh2VkIXG3TmEXyk6JZH1Pzp8MWG9LTaBmqpou To2_4TzeVT2lJy5BR3pUJ2clGPj5p8FzeYqOaitVys3IV_8bKLNDT8qFZdQjvtIE3a3cICTdckMM yPT09IqfpZCScaZWFfePjLoRDLV5AL4__XX3O4QITkoOkiD9m71luRa81T7F3mPOD2DEYmmEVtqi LC.OxWUrHOFRexFWU1Up3e3iPJCAEBrwJYg6OALYHj7rLK_foSMmEZx.HE4cKPAXe7AkbCfMIN6J MpHHsvhNzZ842OnLzFWb2vqPJbgyaAkEyW9.gk8qY7bjhif9l8XZ7.4zidbUqREaWmmDdhzIop99 OjuF3Yx4FCa3m61fX7cBLwo1JSwNNnvax89uuCnNF2mwcOj51IYDRZsPgkOByr_DZFzTEtQlGIyS CZVlvIbX76vFcC_hUqx3TBiQ7t9N0uVRiRPMp2DMlfGrD1PNdnJ7XX3HXK_Su.QEr3MV7X4s1tUi Y93hIe_FpgAvgekUe4RWGYl8lQ_blPLTdoJOSbVD5.wtEe8RgqY_XSxvdCRQozSXplEmN95_0kaD hCAMgAtOO6cV3Z2DtoA4R5w0uzkl9ZAtfNWlFddr1GKGMzo5themZzJ.6_6ZnzqGNCRHyCk2VV5k Tu7FBD2zaOiHNQGJ0YGUJhUJBa9B7MRXg2bPaFlNAafJA..tTvzQgJMCgnW4_4GpqciVnmnB49x_ GB2DVTfkV7r48NQQ75IuJqYW5fbbDli1J7xAqz1eOp X-Sonic-MF: X-Sonic-ID: b6fbedf5-7fbc-4ade-bdec-e25dadeabd3a Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Sat, 12 Aug 2023 07:25:10 +0000 Original-Received: by hermes--production-sg3-69654d8bd-hj7c9 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID bd8fec83af96f8f72d2662510961a441; Sat, 12 Aug 2023 07:25:04 +0000 (UTC) In-Reply-To: <875y5kn3zq.fsf@zohomail.eu> (rahguzar@zohomail.eu's message of "Sat, 12 Aug 2023 08:50:12 +0200") X-Mailer: WebService/1.1.21695 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267280 Archived-At: Rahguzar writes: > Hi Po, > > Po Lu writes: > >> I tried to fix this differently on master. Please see if it resolves >> your problem (and other issues with scrolling past large images.) >> >> As always, keep an eye out for performance regressions. Thanks. > > > The issue is still there and can be reproduced by evaluating > > (let* ((win (display-buffer (get-buffer-create "image-pixel-precision-test"))) > (height (* (window-text-height win t) 2)) > (file "path/to/image")) > (select-window win) > (erase-buffer) > (insert-image (create-image file nil nil)) > (goto-char 1) > (pixel-scroll-precision-mode) > nil) > > The resulting image cannot be scrolled. > > In the new code this is because vscroll is reset to 0 inside the binding > for `line-after`. Commenting out that line allows me to scroll the > image. But as a repercussion, scrolling past the image will result in the window being vscrolled indefinitely. That is unacceptable, because redisplay grows exponentially slower as vscroll increases. Is this compromise acceptable? It will enable scrolling within the last line of the window, but will reset vscroll entirely once the window start becomes invisible, resulting in a visually disconnected ``jump'' back to the top of that line. diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el index 488f6781254..8961f196ec7 100644 --- a/lisp/pixel-scroll.el +++ b/lisp/pixel-scroll.el @@ -543,14 +543,18 @@ pixel-scroll-precision-scroll-down-page (let ((line-after (save-excursion (goto-char new-start-position) (if (zerop (vertical-motion 1)) - (progn - (set-window-vscroll nil 0 t t) - nil) ; nil means move to new-start-position. + nil ; nil means move to new-start-position. (point))))) (if (not line-after) (progn (goto-char new-start-position) - (signal 'end-of-buffer nil)) + ;; If vscroll has resulted in the entire line being + ;; scrolled outside the window's text area, set it to + ;; the height of the last line. + (let ((visibility (pos-visible-in-window-p new-start-position nil t))) + (unless visibility + (set-window-vscroll nil 0) + (signal 'end-of-buffer nil)))) (if (pos-visible-in-window-p line-after nil t) (goto-char line-after) (goto-char new-start-position))))))))