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#5718: scroll-margin in buffer with small line count. Date: Wed, 14 Sep 2016 20:26:57 +0300 Message-ID: <83zina75pa.fsf@gnu.org> References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> <87a8ggwcoo.fsf@users.sourceforge.net> <83inv4cc0s.fsf@gnu.org> <87d1ka17dr.fsf@users.sourceforge.net> <834m5l9g1d.fsf@gnu.org> <874m5j19wi.fsf@users.sourceforge.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1473875407 535 195.159.176.226 (14 Sep 2016 17:50:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Sep 2016 17:50:07 +0000 (UTC) Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 14 19:50:01 2016 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 1bkEJq-0007VH-Et for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 19:49:59 +0200 Original-Received: from localhost ([::1]:57831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkEJo-0002s4-Gf for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Sep 2016 13:49:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDyh-00026W-10 for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:28:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkDyb-00009a-Uc for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:28:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDyb-00009S-Qj for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:28:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bkDyb-0003mj-Lo for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2016 13:28:01 -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, 14 Sep 2016 17:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5718 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5718-submit@debbugs.gnu.org id=B5718.147387404414498 (code B ref 5718); Wed, 14 Sep 2016 17:28:01 +0000 Original-Received: (at 5718) by debbugs.gnu.org; 14 Sep 2016 17:27:24 +0000 Original-Received: from localhost ([127.0.0.1]:59744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkDxz-0003ll-Od for submit@debbugs.gnu.org; Wed, 14 Sep 2016 13:27:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkDxx-0003lZ-9x for 5718@debbugs.gnu.org; Wed, 14 Sep 2016 13:27:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkDxr-00085S-1U for 5718@debbugs.gnu.org; Wed, 14 Sep 2016 13:27:16 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkDxj-0007yv-Ok; Wed, 14 Sep 2016 13:27:07 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3767 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bkDxf-0001oS-TK; Wed, 14 Sep 2016 13:27:06 -0400 In-reply-to: <874m5j19wi.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) 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:123299 Archived-At: > From: npostavs@users.sourceforge.net > Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com > Date: Tue, 13 Sep 2016 22:40:29 -0400 > > Eli Zaretskii writes: > >> I have a patch set for fixing this and allowing the user to change the > >> maximum margin from 0.25. The latter doesn't quite work perfectly, for > >> some reason when setting the maximum margin to 0.5 and scroll-margin to > >> 100, `scroll-down-command' doesn't keep point centered in the window, > >> even though other commands (e.g. `scroll-up-command') do. > > > > However, I think we need to solve those glitches as part of > > introducing the feature. Setting a margin to half the window size > > makes centering point difficult, but since some commands do succeed, > > I'm guessing that those commands which succeed have a bug, i.e. they > > leave point inside the margin. Is that indeed so? > > I'm not sure what you mean by "succeed" here. `next-line', > `previous-line', and `scroll-up-command' are able to keep point ouside > of the margin (thus keeping it centered); `scroll-down-command' leaves > it one line down from where it should be. I assumed that when maximum margin is set to 0.5, there's no way Emacs can center point in the window, because wherever it puts point will be inside the margin. So therefore, if it sometimes does succeed to position point, there must be a bug. However, ... > Actually, the above applies to windows with an odd number of lines, I > realized I didn't account for the case of an even number of lines, which > currently has 0 lines that are outside the margin. I need to change the > cap on `max-scroll-margin' to account for this. ... given the above, I now understand that your interpretation of 0.5 is "half the window minus one line", which leaves the center line for point. Is that so? > I hadn't; trying it out now, it seems to cause `next-line' to also have > the bad behaviour of `scroll-down-command' where point is one line too > far down. Some code involved in this probably assumes the margin cannot be that large. > > Same here (in another function). > > These are 2 different functions: try_window and try_window_id. Oops. Thanks.