From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#27008: 26.0.50; auto-hscroll-mode and scroll-left Date: Wed, 31 May 2017 10:14:41 +0300 Message-ID: <834lw1ebvi.fsf@gnu.org> References: <87shjynvwj.fsf@rosalinde> <83zie6nsip.fsf@gnu.org> <87inkunf4k.fsf@rosalinde> <83efv6e6m0.fsf@gnu.org> <87d1aq9tb6.fsf@rosalinde> <83bmqae00s.fsf@gnu.org> <83a85udzet.fsf@gnu.org> <878tle9lhw.fsf@rosalinde> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1496214923 26421 195.159.176.226 (31 May 2017 07:15:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 31 May 2017 07:15:23 +0000 (UTC) Cc: 27008@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 31 09:15:18 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFxqZ-0006JW-IS for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 May 2017 09:15:11 +0200 Original-Received: from localhost ([::1]:57683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFxqd-0001Qe-8z for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 May 2017 03:15:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFxqU-0001Ok-Bq for bug-gnu-emacs@gnu.org; Wed, 31 May 2017 03:15:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFxqQ-0006J2-9Z for bug-gnu-emacs@gnu.org; Wed, 31 May 2017 03:15:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43442) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dFxqQ-0006Iy-6O for bug-gnu-emacs@gnu.org; Wed, 31 May 2017 03:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dFxqQ-0001k3-2b for bug-gnu-emacs@gnu.org; Wed, 31 May 2017 03:15: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: Wed, 31 May 2017 07:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27008 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27008-submit@debbugs.gnu.org id=B27008.14962148846645 (code B ref 27008); Wed, 31 May 2017 07:15:02 +0000 Original-Received: (at 27008) by debbugs.gnu.org; 31 May 2017 07:14:44 +0000 Original-Received: from localhost ([127.0.0.1]:46118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFxq8-0001j7-6Z for submit@debbugs.gnu.org; Wed, 31 May 2017 03:14:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFxq6-0001im-MM for 27008@debbugs.gnu.org; Wed, 31 May 2017 03:14:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFxpx-0006GO-88 for 27008@debbugs.gnu.org; Wed, 31 May 2017 03:14:37 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFxpx-0006GK-4f; Wed, 31 May 2017 03:14:33 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3827 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dFxpw-0002IX-EZ; Wed, 31 May 2017 03:14:32 -0400 In-reply-to: <878tle9lhw.fsf@rosalinde> (message from Stephen Berman on Tue, 30 May 2017 21:45:47 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133078 Archived-At: > From: Stephen Berman > Cc: 27008@debbugs.gnu.org > Date: Tue, 30 May 2017 21:45:47 +0200 > > Thanks. Yes, with this patch the non-current lines are displayed from > w->min_hscroll. However, there's a new problem: now when points moves > to a line, that line automatically scrolls further by w->min_hscroll. > So when I do `(scroll-left 32 t)' and then move point to another line, > that line scrolls further left so that its column 64 is on the left edge > of the window (the other lines remain displayed starting at column 32). > When point moves to the next line, that one scrolls further to column 64 > and the previous one goes back to being displayed from column 32. Does the below (to be applied on top of current master, i.e. first revert the previous patch) fix this? diff --git a/src/xdisp.c b/src/xdisp.c index c03689b..c96ffce 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2890,8 +2890,19 @@ init_iterator (struct it *it, struct window *w, } else { + /* When hscrolling only the current line, don't apply the + hscroll here, it will be applied by display_line when it gets + to laying out the line showing point. However, if the + window's min_hscroll is positive, the user specified a lower + bound for automatic hscrolling, so they expect the + non-current lines to obey that hscroll amount. */ if (hscrolling_current_line_p (w)) - it->first_visible_x = 0; + { + if (w->min_hscroll > 0) + it->first_visible_x = w->min_hscroll * FRAME_COLUMN_WIDTH (it->f); + else + it->first_visible_x = 0; + } else it->first_visible_x = window_hscroll_limited (w, it->f) * FRAME_COLUMN_WIDTH (it->f); @@ -13099,7 +13110,9 @@ hscroll_window_tree (Lisp_Object window) that doesn't need to be hscrolled. If we omit this condition, the line from which we move will remain hscrolled. */ - || (hscl && w->hscroll && !cursor_row->truncated_on_left_p))) + || (hscl + && w->hscroll != w->min_hscroll + && !cursor_row->truncated_on_left_p))) { struct it it; ptrdiff_t hscroll; @@ -20710,7 +20723,9 @@ display_line (struct it *it, int cursor_vpos) /* If we are going to display the cursor's line, account for the hscroll of that line. */ if (hscroll_this_line) - x_incr = window_hscroll_limited (it->w, it->f) * FRAME_COLUMN_WIDTH (it->f); + x_incr = + (window_hscroll_limited (it->w, it->f) - it->w->min_hscroll) + * FRAME_COLUMN_WIDTH (it->f); /* Move over display elements that are not visible because we are hscrolled. This may stop at an x-position < first_visible_x