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

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

Buggy scroll-up (was: scroll-margin buggy on Emacs 21.1)


From: Hanak David
Subject: Buggy scroll-up (was: scroll-margin buggy on Emacs 21.1)
Date: Sun, 15 Jun 2003 12:06:00 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Hi,

There was quite a bit of traffic about vertical scrolling hanging emacs
when scroll-margin is set.  I tried to do a little research on the topic
and got the following.

Last time I wrote:

> Invoked "emacs -q --no-site-file", then I did
>
>    M-x set-variable RET scroll-margin RET 2 RET
>
> Emacs locks up "only" when the last line of the buffer is visible in the
> window, but it is (strictly) closer to the bottom than scroll-margin and
> there are some blank lines, too.  So, by setting s-m to 2, the problem
> occurs only when there is exactly one blank line at the bottom.  [...]

I have to amend that: the problem occurs only in 21.* emacsen, and only if
scoll-margin*2 > next-screen-context-lines.  So a workaround for everyone
is to set n-s-c-l to at least 2 * s-m.  The behaviour of emacs in that case
is still funny at the end of buffers, but at least it doesn't lock up.

I also tried to debug it.  The problem is (quite expectedly) in file
window.c, function window_scroll_pixel_based, lines 4126-4127.

,----[ window.c, lines 4121-4129 ]
|       if (n > 0)
|       {
|         /* We moved the window start towards ZV, so PT may be now
|            in the scroll margin at the top.  */
|         move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
|         while (it.current_y < this_scroll_margin)
|           move_it_by_lines (&it, 1, 1);
|         SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
|       }
`----

The while loop turns out to be an infinite loop, because move_it_by_lines
doesn't increase it.current_y.

I believe the problem is that when emacs tries to preserve lines from the
previous page, it is confused by the empty lines at the bottom of the
window.  Howver, I don't exactly know how or why.

Would someone who's familiar with window.c go deeper into it?  It is the
first time I'm looking at emacs source, so I wouldn't mind if this person
didn't have to be me.

David




reply via email to

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