On Fri, Dec 10, 2010 at 1:31 PM, Bram Moolenaar <[email protected]> wrote:

>
> David Lam wrote:
>
> > hmm well, one handy thing I use a lot with vim is viewing/editing
> different
> > parts of the same file via a :vsplit or <C-w>v
> >
> > and awhile ago, I remember after updating and building from the latest
> > patched vim,that something felt funny when vertical splitting,  because
> the
> > cursor/window would scroll to the top instead of staying in the same
> place.
> >
> > To reproduce:
> >    1. open a file which you would have to scroll to see the whole file in
> > 7.3
> >    2. push L
> >    3.<C-w>v  or :vsplit
> >    4. The window/cursor on the left scrolls to the top  (when it should
> > really stay in the place?)
> >
> >
> > I did a little testing and I think in versions prior, the cursor stays in
> > the same place.  Reverting one line from 7.2.398 seemingly fixes it  -->
> >
> > diff -r a03f7551bacc src/window.c
> > --- a/src/window.c    Wed Dec 08 19:56:58 2010 +0100
> > +++ b/src/window.c    Thu Dec 09 01:06:58 2010 -0800
> > @@ -1003,7 +1003,7 @@
> >      {
> >          /* height and row of new window is same as current window */
> >          wp->w_winrow = oldwin->w_winrow;
> > -        win_new_height(wp, oldwin->w_height);
> > +        wp->w_height = oldwin->w_height;
> >          wp->w_status_height = oldwin->w_status_height;
> >      }
> >      frp->fr_height = curfrp->fr_height;
>
> I wonder if something goes wrong in other circumstances.
>
> win_new_height() is supposed to keep the relative cursor position.
> Perhaps there is something missing to copy the relative position to the
> new window?
>
> --
> hundred-and-one symptoms of being an internet addict:
> 10. And even your night dreams are in HTML.
>
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
> \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/\\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
>  ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org
>  ///
>

*think* I found it....  seems like there's this check in win_new_height() on
window.c:5475 that isn't being followed right...

if (wp->w_height == height)
    return;        /* nothing to do */

so remember to add the original window height -->

--- ../vim-7.3.81/src/window.c    2010-12-08 12:06:34.000000000 -0800
+++ src/window.c    2010-12-13 02:24:50.000000000 -0800
@@ -1003,6 +1003,7 @@
     {
         /* height and row of new window is same as current window */
         wp->w_winrow = oldwin->w_winrow;
+        wp->w_height = oldwin->w_height;
         win_new_height(wp, oldwin->w_height);
         wp->w_status_height = oldwin->w_status_height;
     }


as an aside, it also seems like :split is also scrolling the cursor around
too?  not totally sure if that's the intended behavior or not

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui