Bram Moolenaar wrote:

> Robert Webb wrote:
> 
> > This appears to be a bug.  Consider this test function.
> > 
> >   func! Test()
> >     let oldCursor = winsaveview()
> >     normal G
> >     call winrestview(oldCursor)
> >     split
> >   endfunc
> > 
> > Now edit a long file and go somewhere where the end of the file is not
> > too close, and call the function:
> > 
> >     :call Test()
> > 
> > It splits a new window.  Now close this window again, and in theory we
> > should be exactly back to where we started, however instead the cursor
> > line has shifted to the bottom line of the window (the cursor is still
> > on the same line, but the window has scrolled).
> > 
> > Why?  The first three lines of the function should be a no-operation.
> > Comment out the split and you'll see that it does as expected.
> > Comment out the other three lines and again it behaves as expected.
> > But with all lines something is wrong.
> > 
> > I also tried saving restoring the window by remembering the top line
> > and restoring it later, but it has the same problem.  It is as if the
> > split command is occurring in part before the window is restored.
> > 
> > Anyone know how to work-around this for now?
> 
> It works just fine for me.  Perhaps you have something else that
> interferes?

I managed to track it down.  You have to do ":set nowrap" too.
Now even if no lines in the file are long enough for 'wrap' to make
a difference, the bug will occur.

I suggest starting with a long file and doing "50%" to go in half-way.
Then ":call Test()" and the cursor line from the original window is now
at the bottom instead of half-way down that window.

Rob.

--

Robert Webb <[EMAIL PROTECTED]>,
Want to make polyhedra?
http://www.software3d.com/Stella.php

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui