From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19060: [FIX INCLUDED] Off-by-one-line scrolling bug in window_scroll_pixel_based Date: Sat, 15 Nov 2014 13:17:47 +0200 Message-ID: <83lhncg1b8.fsf@gnu.org> References: <83wq6wg6fq.fsf@gnu.org> <5467354D.3000600@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1416050371 11984 80.91.229.3 (15 Nov 2014 11:19:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 11:19:31 +0000 (UTC) Cc: kelly@prtime.org, 19060@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 15 12:19:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XpbNx-00046u-HF for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 12:19:21 +0100 Original-Received: from localhost ([::1]:39856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpbNx-0000WQ-2F for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 06:19:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpbNk-0000W9-VT for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 06:19:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpbNe-0005Ze-BB for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 06:19:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpbNe-0005Za-7v for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 06:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XpbNe-0007YN-02 for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 06:19: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: Sat, 15 Nov 2014 11:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19060 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19060-submit@debbugs.gnu.org id=B19060.141605028828963 (code B ref 19060); Sat, 15 Nov 2014 11:19:01 +0000 Original-Received: (at 19060) by debbugs.gnu.org; 15 Nov 2014 11:18:08 +0000 Original-Received: from localhost ([127.0.0.1]:33291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpbMl-0007X5-Hz for submit@debbugs.gnu.org; Sat, 15 Nov 2014 06:18:07 -0500 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:37547) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpbMi-0007Wv-PT for 19060@debbugs.gnu.org; Sat, 15 Nov 2014 06:18:05 -0500 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NF200500UQJGQ00@a-mtaout22.012.net.il> for 19060@debbugs.gnu.org; Sat, 15 Nov 2014 13:18:02 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NF2005FWVE29D70@a-mtaout22.012.net.il>; Sat, 15 Nov 2014 13:18:02 +0200 (IST) In-reply-to: <5467354D.3000600@gmx.at> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96054 > Date: Sat, 15 Nov 2014 12:13:17 +0100 > From: martin rudalics > CC: 19060@debbugs.gnu.org > > > diff --git a/src/window.c b/src/window.c > > index b002423..7462fdc 100644 > > --- a/src/window.c > > +++ b/src/window.c > > @@ -4956,8 +4956,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) > > int px; > > int dy = frame_line_height; > > if (whole) > > - dy = max ((window_box_height (w) > > - - next_screen_context_lines * dy), > > + dy = max ((window_box_height (w) / dy > > + - next_screen_context_lines) * dy, > > dy); > > dy *= n; > > > > @@ -5039,8 +5039,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) > > { > > ptrdiff_t start_pos = IT_CHARPOS (it); > > int dy = frame_line_height; > > - dy = max ((window_box_height (w) > > - - next_screen_context_lines * dy), > > + dy = max ((window_box_height (w) / dy - next_screen_context_lines) * dy, > > dy) * n; > > > > /* Note that move_it_vertically always moves the iterator to the > > If it works for you, please apply it. It evidently works for Kelly. > I'm too silly to understand it, though. IIUC we have a rounding > issue which makes us go by one line too far or too few when > scrolling up and your patch compensates that rounding issue by > putting it back into that window_box_height (w) / dy calculation. Yes. Why is it hard to understand? > Could you add comments which tell more or less how you corrected the > issue? Will do, once we agree that this is the right fix.