bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5718: scroll-margin in buffer with small line count.


From: Eli Zaretskii
Subject: bug#5718: scroll-margin in buffer with small line count.
Date: Wed, 14 Sep 2016 20:26:57 +0300

> 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.
> >
> > 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]