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.bugs Subject: bug#72323: 31.0.50; line-move unconditionally resets vscroll to 0 Date: Sun, 28 Jul 2024 07:50:57 +0300 Message-ID: <86cymy15n2.fsf@gnu.org> References: <87zfq2hg4n.fsf@stebalien.com> <86ikwq1z92.fsf@gnu.org> <87v80qha04.fsf@stebalien.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29246"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72323@debbugs.gnu.org, storm@cua.dk To: Steven Allen , Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 28 06:53:10 2024 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 1sXvu9-0007UC-OB for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Jul 2024 06:53:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXvtl-0006oK-44; Sun, 28 Jul 2024 00:52:45 -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 1sXvsu-0006kX-NN for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 00:52:40 -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 1sXvst-0005B9-Ht for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 00:51:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=8nQ0nUslICOrIn6Wjuywgwj/E3wVtKUpE+JM75VT7Jg=; b=h0iLRtojOrXUGv4apaXcLf/jm6oZlSRX9QQkH3OaFBzjYjpYsVNZ6vS1ZTr2FJLYmvfg3RYCtFSlmSJX//u0lbr14gQ8R3qdF52Zcc53AQTlbz3CtQZE4Y4G+QPPlhdnYR5lhjW2uJZ67DapCDW0lFBhkQf1Dz5PGW0mvEd12bnLK+5iOqYH9TnThTsoLU2bRM5f0CitFK/UVNyetk7uCTQxkuDu0DITmURWJvEkgmqKr4NREGBSRk4l4bckPQAJWWE4EOqxzV14f5itZ43dt003bumMhfHsI0vzLxizqMumMXIsHzzo5rFJz8IEDbYbLKqOPgwwX0Puv5gf0aetsw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sXvt4-00044A-DL for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 00:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jul 2024 04:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72323 X-GNU-PR-Package: emacs Original-Received: via spool by 72323-submit@debbugs.gnu.org id=B72323.172214228215559 (code B ref 72323); Sun, 28 Jul 2024 04:52:02 +0000 Original-Received: (at 72323) by debbugs.gnu.org; 28 Jul 2024 04:51:22 +0000 Original-Received: from localhost ([127.0.0.1]:42584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXvsQ-00042t-21 for submit@debbugs.gnu.org; Sun, 28 Jul 2024 00:51:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXvsN-00042f-Cd for 72323@debbugs.gnu.org; Sun, 28 Jul 2024 00:51:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXvs5-0004r0-1S; Sun, 28 Jul 2024 00:51:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=8nQ0nUslICOrIn6Wjuywgwj/E3wVtKUpE+JM75VT7Jg=; b=ROv5R+LUkJDo ZmyhALhuDnE0v0BGbqQmVh2fn4wqZoRrgXtQiU7pNI5Cb/v5uSzAgE5ous6wdD+pWeAamCQwCQtB1 ts86AUYTUtrRHn/qMBQuXrQC1eoU5q94uzd7kUIvvLY5bl0WPOlFmT6wr1JzVgEQ7hTmGa7fmLLlc SXgk9vyvi+EUf/XqvJN0xV5QkRqorWLgo6KClmMFUxqwM4fpEw4djLgP53GX3Njjzk4raPNEXZ2jf udOO5gB1GlIjq7ntD8ZWsMWYPK2Lo8sYpJ5mipA91opeF/gkcrb8Wz7UbzsJ8gqsDjB81ixA66Dqo 8Wwc1LVP0zTodupn59vadA==; In-Reply-To: <87v80qha04.fsf@stebalien.com> (message from Steven Allen on Sat, 27 Jul 2024 13:10:03 -0700) 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:289452 Archived-At: > From: Steven Allen > Cc: 72323@debbugs.gnu.org, storm@cua.dk > Date: Sat, 27 Jul 2024 13:10:03 -0700 > > >> Fixing home/end (beginning of line, end of line) case seems trivial: > >> don't call `line-move' in these cases (or have `line-move' short-circuit > >> when `arg' is 0). However, even after reading all the comments about > >> scrolling images, I'm still not sure why it's necessary to reset vscroll > >> to 0. > > > > Because otherwise what line-move does cannot be described in sensible > > terms. If vscroll is not reset, then what would be the reference for > > such a "line move"? By its very definition, line-move moves N screen > > lines wrt the line which was its starting point, but with vscroll > > non-zero that starting point could be anywhere. > > I'm a bit confused because vscroll is about scrolling the window and > `line-move' is about moving point (only incidentally scrolling the > window if the point leaves it). Clearly `set-window-start' needs to > reset `vscroll', but I'm not sure I understand why `line-move' does. vscroll is not just about scrolling the window. It is basically a vertical offset from the screen line that shows window-start to the top-most pixel shown in the window. It is meant to enable to see the tall screen line at window-start in its entirety. Once point moves off that screen line, vscroll is no longer pertinent, since the important line, for which vscroll has been determined, has changed. For example, imagine that the line into which point moves cannot be displayed in its entirety with this vscroll, because it starts at a different vertical coordinate (so its lower part could be below the window bottom). > Is this about detecting the correct column? No, I don't think columns are related. > > line-move is not just for scrolling across images, it is also about > > scrolling across tall text lines and other display elements. In any > > case, asking for removal of that reset is a non-starter, for the > > reasons explained above, so it isn't going to happen. The solution > > for any Lisp program that doesn't want vscroll to be rest is not to > > call line-move. > > Now that I do more testing, I can see how removing that line breaks > `line-move' although I'm still not sure why. > > Would it be acceptable to restore the vertical scroll position as long > as `line-move' hasn't otherwise scrolled the screen? See attached patch. Sorry, I don't want to make changes in that function whose purpose is to serve use cases which this function is not designed to support. The code there is quite fragile and it needs to support a large number of use cases, some of which with subtle aspects (e.g., did you try line truncation? did you try visual-line-mode? etc.). In addition, the code there is too tightly-coupled with code in the related functions: line-move-1, line-move-partial, and line-move-finish. They all work in unison to support the various use cases, and changing one without the others is very risky. It took us a long time to arrive at what we have there, solving quite a few bugs as we went. Making significant changes that at this point in support of application-level issues would be unimaginable from where I stand. Problems with pixel-scroll-precision-mode should be solved in that mode. I'm against modifying line-move and related subroutines in order to solve problems in Lisp programs that are not bugs in the algorithm of line-move. I've added Po Lu to this discussion in the hope that he could have comments and suggestions for solving the problems in pixel-scroll-precision-mode you mentioned in the original message.