Subject: bug#6264: 23; scrolling up erratic when line fractions visible at bottom of window

From: David Reitter <[email-masked]>
Date: Mon, 24 May 2010 22:23:32 -0400

Moving down in a buffer does not work well at all when the last line in the window is not fully visible.

The problem occurs in a wide variety of conditions, but here is a test case that works for me:

Emacs -Q  [23 branch build, NS port]
(setq scroll-conservatively 100)
(setq line-spacing 0.6)
(modify-frame-parameters nil '((height . 20)))

Insert some 40 lines of text into the buffer.

Now set point somewhere near the beginning of the buffer, and press <down> repeatedly to scroll the buffer.

You will see at some point that the text is scrolled up by more than one line so the cursor moves vertically up and down. Screenshots down-0 and down-1 illustrate this.

What should happen is that the window scroll so that the baseline of the last text line stays the same, analogous to what happening when we're at the top end of the window, pressing <up>.

NOTE: the above works with the default font (Monaco) on my system; on other systems or with other ports, slightly different line-spacing would apply.

Another, perhaps related problem:
Bottom line (before scrolling starts): here we have a buffer with lines that have different heights (AUCTeX).  
We've got scroll-margin at 0, scroll-conservatively at 10000,  scroll-up-aggressively nil.  The attached screenshot (bottom-half-line) illustrates the problem: the last line is half-visible (that's OK), but the window scrolls too late.

The problem can be seen in the above Emacs -Q session with (setq line-spacing 1.2).