From: Eli Zaretskii <eliz@gnu.org>
To: npostavs@users.sourceforge.net
Cc: ahyatt@gmail.com, 5718@debbugs.gnu.org, gavenkoa@gmail.com
Subject: bug#5718: scroll-margin in buffer with small line count.
Date: Sat, 07 Jan 2017 10:17:28 +0200 [thread overview]
Message-ID: <831swfcmhz.fsf@gnu.org> (raw)
In-Reply-To: <87pok555q4.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net)
> From: npostavs@users.sourceforge.net
> Cc: 5718@debbugs.gnu.org, ahyatt@gmail.com, gavenkoa@gmail.com
> Date: Mon, 02 Jan 2017 19:48:03 -0500
>
>
> [1:text/plain Hide]
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> 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 <eliz@gnu.org> 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.
> [...]
> >
> > ... 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?
>
> Yes, I hadn't quite thought it through, but that was my intention. I've
> updated the code to clarify this.
Thanks.
I think the remaining issues are minor (modulo the couple of questions
below), so I think you should install your changes
> The issues with `scroll-down-command' (and `next-line', below) remain.
> I find the following change fixes the problem for `scroll-down-command',
> though I'm not sure whether it's the right thing to do.
>
> --- a/src/window.c
> +++ b/src/window.c
> @@ -5148,7 +5148,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror)
> in the scroll margin at the bottom. */
> move_it_to (&it, PT, -1,
> (it.last_visible_y - WINDOW_HEADER_LINE_HEIGHT (w)
> - - this_scroll_margin - 1),
> + - this_scroll_margin - 1 - frame_line_height),
> -1,
> MOVE_TO_POS | MOVE_TO_Y);
Can you explain why this fixes the problem? IOW, what was the problem
with the original code, and why moving to the previous screen line
here solves the problem?
Also, does this correction need to be conditional on the new variable
in some way, or is it correct in the general case as well?
> (defun line-move (arg &optional noerror _to-end try-vscroll)
> ...
> (unless (and auto-window-vscroll try-vscroll
> ;; Only vscroll for single line moves
> (= (abs arg) 1)
> ;; Under scroll-conservatively, the display engine
> ;; does this better.
> (zerop scroll-conservatively)
> ...
> (line-move-partial arg noerror))
> ...
> (prog1 (line-move-visual arg noerror)
>
> The problem involves partial lines. In a window where
> (window-screen-lines) returns 7.222, doing M-: (vertical-motion '(0.0
> . 1)) does not scroll the window, which lets point end up 1 line away
> from the center. Doing M-: (vertical-motion '(0.0 . -1)) does scroll
> the window, keeping the point in the center (as expected).
>
> Adjusting the window so that (window-screen-lines) returns 7.0, there is
> no discrepancy between up and down motion.
>
> I guess there is some incorrect boundary condition in try_scrolling,
> though I haven't worked out where.
Could be some off-by-one error when comparing with the window height.
This sounds like a minor issue in an extreme (and thus rare)
situation, so I'm not sure it should prevent installing this.
Thanks.
next prev parent reply other threads:[~2017-01-07 8:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-14 17:26 bug#5718: scroll-margin in buffer with small line count Oleksandr Gavenko
2016-08-11 4:11 ` Andrew Hyatt
2016-08-11 12:03 ` npostavs
2016-08-11 13:05 ` Oleksandr Gavenko
2016-08-11 13:24 ` Noam Postavsky
2016-08-12 7:54 ` Oleksandr Gavenko
2016-08-11 15:28 ` Eli Zaretskii
2016-08-13 22:01 ` npostavs
2016-08-14 2:36 ` Eli Zaretskii
2016-09-11 20:58 ` npostavs
2016-09-12 6:19 ` martin rudalics
2016-09-14 2:23 ` npostavs
2016-09-14 5:30 ` martin rudalics
2016-09-12 17:36 ` Eli Zaretskii
2016-09-14 2:40 ` npostavs
2016-09-14 17:26 ` Eli Zaretskii
2017-01-03 0:48 ` npostavs
2017-01-07 8:17 ` Eli Zaretskii [this message]
2017-01-14 4:18 ` npostavs
2017-01-14 7:58 ` Eli Zaretskii
2017-01-15 21:43 ` npostavs
2017-01-16 17:08 ` Eli Zaretskii
2017-01-21 18:46 ` npostavs
2017-01-21 19:17 ` Eli Zaretskii
2017-01-22 17:21 ` npostavs
2017-01-22 17:58 ` Eli Zaretskii
2017-01-29 0:57 ` npostavs
2017-01-30 15:29 ` Eli Zaretskii
2017-01-31 4:52 ` npostavs
2017-01-31 15:33 ` Eli Zaretskii
2017-02-03 2:40 ` npostavs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=831swfcmhz.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=5718@debbugs.gnu.org \
--cc=ahyatt@gmail.com \
--cc=gavenkoa@gmail.com \
--cc=npostavs@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).