On 15/02/10 9:38 PM, Ben Schmidt wrote:
Works for me in gvim 7.2.359 (Huge) with GTK2/Gnome2 GUI, both in GUI
mode and in Console mode, regardless of the 'scrolloff' setting.
Sample test case:
1. Hit F1
The help.txt helpfile is displayed, cursor at top.
2. Ctrl-F Ctrl-F
Scrolls by two pages, cursor at top (or near top if 'scrolloff' nonzero)
3. Ctrl-B Ctrl-B
Scrolls back up to top of file; cursor is at bottom of screen (or near
bottom if 'scrolloff' nonzero).
This is very strange. We have
7.2.359 on Kubuntu buggy
7.2.350, 359 on Mac OS X buggy
7.2 (.something?) on Red Hat buggy
7.2.184 on Windows OK
7.2.359 on Tony's machine OK
What's your OS, Tony?
It looks perhaps platform specific, but I can't think of any reason it
should be. But different versions are exhibiting similar behaviour, and
similar versions with similar features exhibiting different behaviour,
so it doesn't seem version or feature specific.
FOUND IT!
Correct behaviour relies on a long overflowing, which it does on 32 bit
machines, but not on 64 bit machines.
From onepage(...) in move.c:
long n;
...
while (n <= curwin->w_height && loff.lnum >= 1)
{
topline_back(&loff);
n += loff.height;
}
if (n <= curwin->w_height) /* at begin of file */
...
From topline_back(...) in move.c:
if (lp->lnum < 1)
lp->height = MAXCOL;
From vim.h:
#if SIZEOF_INT >= 4
# ifdef __MVS__
# define MAXCOL (0x3fffffffL) /* maximum column number, 30 bits */
# else
# define MAXCOL (0x7fffffffL) /* maximum column number, 31 bits */
# endif
#else
In the usual, non __MVS__ case, on 32 or 64 bit machines, we have
MAXCOL=0x7fffffffL. On at least most 32 bit machines,
sizeof(int)==sizeof(long), so n overflows and becomes negative at
n += loff.height when we reach top-of-file, and the if is entered. On at
least some 64 bit machines, sizeof(int)<sizeof(long) (4 vs. 8, it
seems), and so n does not overflow but just gets huge.
The code is clearly wrong, but I'm not 100% sure what the intentions
are.
Perhaps the if should be
if (loff.lnum < 1) /* at begin of file */
?
I don't have time right now to try it, and my build environment isn't
quite set up right yet and not worth the trouble to do so as I'm
thinking of doing an OS reinstallation in a day or two. Can someone else
review the change / test it / suggest something else if it's wrong?
Ben.
--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php