Bug? Session loading may scroll up needlessly high

0 views
Skip to first unread message

Tony Mechelynck

unread,
Jan 17, 2008, 2:26:31 PM1/17/08
to vim...@googlegroups.com, Bram Moolenaar
Session loading may scroll up needlessly high

The cursor line is always scrolled to the top of the window (plus 'scrolloff'
if set), regardless of whether there are additional lines (and how many of
them) after it.

Reproducible: Always

Steps to reproduce:
1. Edit (or view) a file which is longer than the window size.
2. G
-- Note that the cursor is at the bottom of the window space. This is normal.
3. :mks!
4. :qa
5. vim -S

Actual result:
The cursor line (which is the last line of the file) is now near the top of
the window, with a lot of ~ lines ("lines" after the end of file) below it.

Expected result:
The bottom line of the file should be at the bottom of the window (as it was
at step 2), with no ~ lines showing.

Additional info:

Happens identically in GUI and Console modes.
'sessionoptions' is at its default value.

Workaround:
Use

gg^O

in each window after restarting, where ^O is obtained by hitting ctrl-v ctrl-o
This must be done _manually_; ":windo normal gg^O" will change the current
file in all windows.

Using:

openSUSE Linux 10.3

VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 17 2008 02:10:07)
Included patches: 1-231
Compiled by antoine.m...@skynet.be
Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
[...]

It happened the same way at earlier patchlevels. I just thought I'd report it.


Best regards,
Tony.
--
Around computers it is difficult to find the correct unit of time to
measure progress. Some cathedrals took a century to complete. Can you
imagine the grandeur and scope of a program that would take as long?
-- Epigrams in Programming, ACM SIGPLAN Sept. 1982

Andy Wokula

unread,
Jan 17, 2008, 3:59:06 PM1/17/08
to vim...@googlegroups.com
Tony Mechelynck schrieb:

I cannot reproduce the problem with gVim 7.1.203 on Win32
(Big version with GUI).

I checked with
gvim -u NONE -U NONE -i NONE -N
for :mks!, and
gvim -u NONE -U NONE -i NONE -N -S
to load the session.

I tested three different files (a 1370, 135, 40 lines).

After step 5, the cursor is always at the bottom (as expected).

--
Andy

Tony Mechelynck

unread,
Jan 17, 2008, 6:31:00 PM1/17/08
to vim...@googlegroups.com

Hm. I have both a vimrc and a viminfo (no gvimrc though), and I am on Linux. I
wonder what causes the behaviour I see.

I'm posting my Session.vim, which is not for the minimum testcase, as
http://users.skynet.be/antoine.mechelynck/vim/Session.vim


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
242. You turn down a better-paying job because it doesn't come with
a free e-mail account.

Andy Wokula

unread,
Jan 17, 2008, 7:19:59 PM1/17/08
to vim...@googlegroups.com
Tony Mechelynck schrieb:

>> Tony Mechelynck schrieb:
>>> Session loading may scroll up needlessly high
>>>
>>> The cursor line is always scrolled to the top of the window (plus 'scrolloff'
>>> if set), regardless of whether there are additional lines (and how many of
>>> them) after it.
>>>
>>> Reproducible: Always
>>>
>>> Steps to reproduce:
>>> 1. Edit (or view) a file which is longer than the window size.
>>> 2. G
>>> -- Note that the cursor is at the bottom of the window space. This is normal.
>>> 3. :mks!
>>> 4. :qa
>>> 5. vim -S
>>>
>>> Actual result:
>>> The cursor line (which is the last line of the file) is now near the top of
>>> the window, with a lot of ~ lines ("lines" after the end of file) below it.
>>>
>>> Expected result:
>>> The bottom line of the file should be at the bottom of the window (as it was
>>> at step 2), with no ~ lines showing.

> I'm posting my Session.vim, which is not for the minimum testcase, as

I can reproduce it with your Session.vim (ah, it enables "rolodex mode")
-- by creating dummy folders and files, changing some options that produced errors:
guifont, printfont, tabline.

After another :mks! and restart with -S, the problem still persists ...

--
Andy

Andy Wokula

unread,
Jan 18, 2008, 5:29:08 AM1/18/08
to vim...@googlegroups.com
Andy Wokula schrieb:

I think the problem is 'winminheight' being set to zero ...

and a value of 'winheight' big enough to make this a difference from 'winminheight'=1.
'winheight' at a large (or any other) value together with 'winminheight'=1 works ok.

--
Andy

Tony Mechelynck

unread,
Jan 18, 2008, 5:52:15 AM1/18/08
to vim...@googlegroups.com

which is legal, and required by my "rolodex" mode. Having a single (white)
line of text between each (black) statusline would be quite ugly.

>
> and a value of 'winheight' big enough to make this a difference from 'winminheight'=1.
> 'winheight' at a large (or any other) value together with 'winminheight'=1 works ok.
>

well, it is a bug then. Session save/restore scrolls needlessly high when
'winminheight' is zero...


Best regards,
Tony.
--
Has everyone noticed that all the letters of the word "database" are
typed with the left hand? Now the layout of the QWERTYUIOP typewriter
keyboard was designed, among other things, to facilitate the even use
of both hands. It follows, therefore, that writing about databases is
not only unnatural, but a lot harder than it appears.

Reply all
Reply to author
Forward
0 new messages