From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#5718: scroll-margin in buffer with small line count. Date: Sat, 13 Aug 2016 18:01:43 -0400 Message-ID: <87a8ggwcoo.fsf@users.sourceforge.net> References: <4B9D1C61.70903@gmail.com> <87mvkjy0l5.fsf@users.sourceforge.net> <83fuqbfhpb.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1471125744 2652 195.159.176.226 (13 Aug 2016 22:02:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 13 Aug 2016 22:02:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 14 00:02:20 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 1bYh0V-0000Pn-J3 for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Aug 2016 00:02:19 +0200 Original-Received: from localhost ([::1]:58671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYh0R-00022X-RZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Aug 2016 18:02:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYh0I-00022N-7V for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 18:02:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYh0E-0006X8-1J for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 18:02:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYh0D-0006X4-US for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 18:02:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bYh0D-0001RS-OC for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2016 18:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Aug 2016 22:02: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.14711257025515 (code B ref 5718); Sat, 13 Aug 2016 22:02:01 +0000 Original-Received: (at 5718) by debbugs.gnu.org; 13 Aug 2016 22:01:42 +0000 Original-Received: from localhost ([127.0.0.1]:56610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYgzu-0001Qt-D8 for submit@debbugs.gnu.org; Sat, 13 Aug 2016 18:01:42 -0400 Original-Received: from mail-it0-f48.google.com ([209.85.214.48]:38088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYgzs-0001Qf-5B for 5718@debbugs.gnu.org; Sat, 13 Aug 2016 18:01:40 -0400 Original-Received: by mail-it0-f48.google.com with SMTP id c13so1912098ith.1 for <5718@debbugs.gnu.org>; Sat, 13 Aug 2016 15:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=muawG+T2jJzpoEfZ9t7cc2R9yD9Uo6iHSF+t4I8SW04=; b=DsEGcaL2J11fO8ID+bZdaOipSYPRf9MlC8kq2g7/SqtlPcHCxeLAehlXQpSCoxMzxj /b3YR1gk1EhJN6Ki6d7QMZAUKDKQvdfz6oWGIuIMrZH+bGJOIF1sFMsGs57KwV+Iae+q E0EbI/sDDJuI09U3ElCLp3VW7px2H1Zpoa2LbnQvxrZqmjEWWhiEny2auzJIoljNcUPe SrGyAUt8ZOtyct9ukxiX/KKrzFhzAW/H6Bm02DiIAEF18fb1NbSiOfyROEe65zwCsa18 dfamMaRvUqDbuQu9ftD7QpiK8xW4ZfcEcROKg6PE8bJSAnTN/iwnmTzgK6dZEUXl/iTq qRcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=muawG+T2jJzpoEfZ9t7cc2R9yD9Uo6iHSF+t4I8SW04=; b=XXci+Lkawhv/5c6/MsM4KQ95n0249BJuYuANWX/nsWWsVHh6b0trpro0cj1tyNev5m nS2A9KIJ4mgLeipf4Z3YOK37aawk6hiqbKXjKvUJhDmFhESbfgmMR59o2+0EVSbR7mzd PO+8MMLiFj16M2Yt9JDWl4OlELEuYvBiO4+kbyQrckB6agCTVQ2/n/1W1MycajgKN/lk M+DYYrdxpHWEP7DTVZD/4wGQq3a6XAZgawBT1lMgsBq+P3ZdSE81pVcUe0M1rii8qTNf rIq3Ci+YH5KYiCVzkAkMyjcZpAVJvBGURFVBNDq+mIAPDbPb2VpBDXebxChhEToQYUUB U6ug== X-Gm-Message-State: AEkoousfiyQCMaccYtYLM63/nkL5tsSuR2u0UUzPqGwyoxbAM6krZYnxsUgPztRLd4bWjQ== X-Received: by 10.36.17.140 with SMTP id 134mr5903551itf.70.1471125694602; Sat, 13 Aug 2016 15:01:34 -0700 (PDT) Original-Received: from zony (206-188-64-44.cpe.distributel.net. [206.188.64.44]) by smtp.googlemail.com with ESMTPSA id o15sm5127869ith.2.2016.08.13.15.01.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 13 Aug 2016 15:01:33 -0700 (PDT) In-Reply-To: <83fuqbfhpb.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 11 Aug 2016 18:28:32 +0300") 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:122182 Archived-At: Eli Zaretskii writes: >> >> I think the complaint is that the `scroll-margin' effective value is >> capped at a 1/4 of the window height, as seen in this >> window_scroll_pixel_based (window.c): >> >> this_scroll_margin = max (0, scroll_margin); >> this_scroll_margin >> = min (this_scroll_margin, window_total_lines / 4); > > Which reveals a subtle bug: the actual scroll margin should be 1 for 7 > lines, 2 for 11, etc. The problem is that the value of > window_total_lines includes the mode line, which it shouldn't. Maybe > this should be fixed. I was looking at fixing it, but I got confused by this comment in window.h: /* Height in pixels, and in lines, of the mode line. May be zero if W doesn't have a mode line. */ #define WINDOW_MODE_LINE_HEIGHT(W) \ How is the height "in pixels, and in lines"? Doesn't it have to be one or the other? > >> Whereas, it seems more logical to cap it at half window height. > > No, I think it would leave too few lines for moving the cursor. This > has been Emacs behavior since time immemoriam, so if we want to have a > different behavior, it should be implemented an opt-in option, not the > default. Yes, sure. This is about Emacs' behaviour after the user has customized scroll-margin, so the default isn't in question anyway. I imagine something like this: DEFVAR_LISP ("minimum-non-scroll-lines", Vminimum_non_scroll_lines, doc: /* Lines around window's center where `scoll-margin' doesn't apply. If point is within this many lines from the window's center, it will not cause scrolling regardless of the value of `scroll-margin'. If this is a float then it represents a fraction of the current window's lines. */); Vminimum_non_scroll_lines = make_float (1.0/4.0); And then setting this to 1 would make scroll-margin have the effect that the OP expects.