unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Hanak David <dhanak@inf.bme.hu>
Subject: Buggy scroll-up (was: scroll-margin buggy on Emacs 21.1)
Date: Sun, 15 Jun 2003 12:06:00 +0200	[thread overview]
Message-ID: <m2k7bn64fr.fsf@maui.hanak.hu> (raw)
In-Reply-To: m27k7prmjg.fsf@maui.hanak.hu

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	other threads:[~2003-06-15 10:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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     ` Hanak David [this message]
2003-06-15 23:10       ` Buggy scroll-up Dan Jacobson

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=m2k7bn64fr.fsf@maui.hanak.hu \
    --to=dhanak@inf.bme.hu \
    /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).