unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Buggy scroll-up (was: scroll-margin buggy on Emacs 21.1)
       [not found]   ` <m27k7prmjg.fsf@maui.hanak.hu>
@ 2003-06-15 10:06     ` Hanak David
  2003-06-15 23:10       ` Buggy scroll-up Dan Jacobson
  0 siblings, 1 reply; 2+ messages in thread
From: Hanak David @ 2003-06-15 10:06 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Buggy scroll-up
  2003-06-15 10:06     ` Buggy scroll-up (was: scroll-margin buggy on Emacs 21.1) Hanak David
@ 2003-06-15 23:10       ` Dan Jacobson
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Jacobson @ 2003-06-15 23:10 UTC (permalink / raw)


By the way, I wonder if others also sometimes look up to notice the scroll bars have
disappeared. Version number in my headers.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-15 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3C7D593F.9080906@nnl.se>
     [not found] ` <8361-Sun03Mar2002190054+0200-eliz@is.elta.co.il>
     [not found]   ` <m27k7prmjg.fsf@maui.hanak.hu>
2003-06-15 10:06     ` Buggy scroll-up (was: scroll-margin buggy on Emacs 21.1) Hanak David
2003-06-15 23:10       ` Buggy scroll-up Dan Jacobson

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