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 11:27:05 +0200 Message-ID: <83wq6wg6fq.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Trace: ger.gmane.org 1416043707 14092 80.91.229.3 (15 Nov 2014 09:28:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 09:28:27 +0000 (UTC) Cc: 19060@debbugs.gnu.org To: Kelly Dean , martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 15 10:28:20 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 1XpZeT-00043o-OH for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 10:28:17 +0100 Original-Received: from localhost ([::1]:39583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpZeT-0000Xj-By for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 04:28:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpZeK-0000Xa-Og for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 04:28:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpZeE-0002mF-JU for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 04:28:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpZeE-0002mB-GH for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 04:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XpZeD-0001rM-UP for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 04:28: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 09:28: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.14160436467028 (code B ref 19060); Sat, 15 Nov 2014 09:28:01 +0000 Original-Received: (at 19060) by debbugs.gnu.org; 15 Nov 2014 09:27:26 +0000 Original-Received: from localhost ([127.0.0.1]:33215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpZdd-0001pF-Az for submit@debbugs.gnu.org; Sat, 15 Nov 2014 04:27:25 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:64283) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XpZda-0001oy-FU for 19060@debbugs.gnu.org; Sat, 15 Nov 2014 04:27:23 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NF200I00PYJZ200@a-mtaout20.012.net.il> for 19060@debbugs.gnu.org; Sat, 15 Nov 2014 11:27:21 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NF200I4YQ9KNI90@a-mtaout20.012.net.il>; Sat, 15 Nov 2014 11:27:21 +0200 (IST) In-reply-to: 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:96052 > From: Kelly Dean > Date: Sat, 15 Nov 2014 06:57:45 +0000 > > With 24.4, emacs -Q, then M-x split-window-horizontally, then open any file with a lot of long logical lines (each a few visual lines long), so that as you page down through the file, every screenful of text has some wrapped lines on it. Adjust the vertical size of your Emacs frame so that the vertical size of your Emacs windows is not an integer multiple of the visual line height, so that the bottom visual line of text is partially covered by the top of the mode line. > Scroll forward a couple pages using pgdn (scroll-up-command), then notice exactly which visual line is at the top, and which one is at the bottom. Press pgdn, then pgup, and notice that the text doesn't return to the previous position; instead, it's scrolled backward by one visual line. This bug wasn't in 24.3. > > The bug is in window.c of the 24.4 release, line 5042. The fix is to change ⌜window_box_height (w)⌝ on that line to ⌜window_box_height (w) / dy * dy⌝ in order to align the result to an integer multiple of the visual line height, since as of 24.4, Emacs no longer ensures that window_box_height is such a multiple. Patch excluded, per request. > > There might be a related bug (with the same fix) on line 4959, but I haven't tested that. Martin, I propose the following patch: 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 > BTW on line 471 (copied from line 466) of window.h, ‟width” should be ‟height”. Indeed, and "column" should be "line". Thanks, fixed.