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#29325: 26.0.90: Info scrolling stuck Date: Wed, 22 Nov 2017 17:38:26 +0200 Message-ID: <83r2sqb9xp.fsf@gnu.org> References: <83fu9ehuog.fsf@gnu.org> <83d14hidlk.fsf@gnu.org> <83r2sudwgv.fsf@gnu.org> <83r2ssd7eq.fsf@gnu.org> <837eujcta4.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1511365172 26618 195.159.176.226 (22 Nov 2017 15:39:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 22 Nov 2017 15:39:32 +0000 (UTC) Cc: 29325@debbugs.gnu.org To: charles@aurox.ch Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 22 16:39:28 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 1eHX7U-0006Pv-Rr for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Nov 2017 16:39:25 +0100 Original-Received: from localhost ([::1]:40084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHX7c-0003cX-Aw for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Nov 2017 10:39:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHX7C-0003P1-1Y for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2017 10:39:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHX78-0002nf-Pv for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2017 10:39:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44203) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHX78-0002nY-LY for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2017 10:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eHX78-0007i0-Eo for bug-gnu-emacs@gnu.org; Wed, 22 Nov 2017 10:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Nov 2017 15:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29325 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29325-submit@debbugs.gnu.org id=B29325.151136512029597 (code B ref 29325); Wed, 22 Nov 2017 15:39:02 +0000 Original-Received: (at 29325) by debbugs.gnu.org; 22 Nov 2017 15:38:40 +0000 Original-Received: from localhost ([127.0.0.1]:52884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHX6m-0007hI-6w for submit@debbugs.gnu.org; Wed, 22 Nov 2017 10:38:40 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHX6k-0007h7-Vl for 29325@debbugs.gnu.org; Wed, 22 Nov 2017 10:38:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHX6b-0002Sv-Pn for 29325@debbugs.gnu.org; Wed, 22 Nov 2017 10:38:33 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHX6b-0002Sg-ML; Wed, 22 Nov 2017 10:38:29 -0500 Original-Received: from [176.228.60.248] (port=4753 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eHX6b-000395-23; Wed, 22 Nov 2017 10:38:29 -0500 In-reply-to: <837eujcta4.fsf@gnu.org> (message from Eli Zaretskii on Tue, 21 Nov 2017 21:42:59 +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:140233 Archived-At: > Date: Tue, 21 Nov 2017 21:42:59 +0200 > From: Eli Zaretskii > Cc: 29325@debbugs.gnu.org > > > When causing the problematic behavior, redisplay_window reaches > > try_to_scroll via this if statement: > > > > if (!cursor_row_fully_visible_p (w, false, false)) > > { > > /* Point does appear, but on a line partly visible at end of window. > > Move it back to a fully-visible line. */ > > new_vpos = window_box_height (w); > > /* But if window_box_height suggests a Y coordinate that is > > not less than we already have, that line will clearly not > > be fully visible, so give up and scroll the display. > > This can happen when the default face uses a font whose > > dimensions are different from the frame's default > > font. */ > > if (new_vpos >= w->cursor.y) > > { > > w->cursor.vpos = -1; > > clear_glyph_matrix (w->desired_matrix); > > goto try_to_scroll; > > } > > } > > > > That is, (!cursor_row_fully_visible_p (w, false, false)) and > > (new_vpos >= w->cursor.y) evaluate to true. > > And what are the values of new_vpos and w->cursor.y in this case? And > what is w->cursor.vpos? > > > try_to_scroll looks like this: > > I suspect we shouldn't go there in this case. Actually, I think this code is not supposed to run in the case you describe, i.e. when the user invokes a scrolling command. So I think the root cause is elsewhere. Does the patch below fix the problem? diff --git a/src/window.c b/src/window.c index 7f47252..504dcd3 100644 --- a/src/window.c +++ b/src/window.c @@ -5355,6 +5355,9 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) /* We moved the window start towards BEGV, so PT may be now in the scroll margin at the bottom. */ move_it_to (&it, PT, -1, + /* We subtract WINDOW_HEADER_LINE_HEIGHT because + it.y is relative to the bottom of the header + line, see above. */ (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w) - partial_line_height (&it) - this_scroll_margin - 1), -1, @@ -5392,11 +5395,14 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) /* See if point is on a partially visible line at the end. */ if (it.what == IT_EOB) - partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; + partial_p = + it.current_y + it.ascent + it.descent + > it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w); else { move_it_by_lines (&it, 1); - partial_p = it.current_y > it.last_visible_y; + partial_p = + it.current_y > it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w); } if (charpos == PT && !partial_p @@ -5415,7 +5421,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) goal_y = this_scroll_margin; SET_TEXT_POS_FROM_MARKER (start, w->start); start_display (&it, w, start); - /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT + /* It would be wrong to subtract WINDOW_HEADER_LINE_HEIGHT here because we called start_display again and did not alter it.current_y this time. */ move_it_to (&it, -1, window_scroll_pixel_based_preserve_x,