On Sun, Jun 15, 2014 at 9:16 PM, Christian Brabandt <cbli...@256bit.org>
wrote:

> On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:
>
> > On Sat, Jun 14, 2014 at 10:03 PM, Christian Brabandt <cbli...@256bit.org
> >
> > wrote:
> >
> > > Hi Yukihiro!
> > >
> > > On Sa, 14 Jun 2014, Yukihiro Nakadaira wrote:
> > >
> > > > Cursor is not moved immediately when it is moved to other window at
> once.
> > > >
> > > > Steps to reproduce:
> > > >   $ vim -u NONE
> > > >   :call setline(1, range(100))
> > > >   :split
> > > >   :call cursor(50, 1) | wincmd w        " On first window, cursor is
> not
> > > > moved.
> > > >   :wincmd w                             " Cursor is moved.
> > > >
> > >
> > > This patch should fix it:
> > >
> > > diff -r 6e8b6a7f7bff src/eval.c
> > > --- a/src/eval.c        Sat Jun 14 12:53:33 2014 +0200
> > > +++ b/src/eval.c        Sat Jun 14 15:02:24 2014 +0200
> > > @@ -9882,6 +9882,7 @@
> > >  #endif
> > >
> > >      curwin->w_set_curswant = TRUE;
> > > +    setcursor();
> > >      rettv->vval.v_number = 0;
> > >  }
> > >
> >
> > Thank you.  But it doesn't work for me.  And this problem is not only
> > for cursor().  It is same with setpos() and :123.
>
> Yeah, looks like, this was the wrong solution. Note sure, why it seemed
> to work for me (now I can't make it work any longer). How about, this
> patch, which should redraw the old window, if the cursor position
> changed (thus it should redraw for all your problems mentioned) just
> before switching windows.
>
> diff --git a/src/window.c b/src/window.c
> --- a/src/window.c
> +++ b/src/window.c
> @@ -4250,6 +4250,9 @@ win_enter_ext(wp, undo_sync, curwin_inva
>      /* sync undo before leaving the current buffer */
>      if (undo_sync && curbuf != wp->w_buffer)
>         u_sync(FALSE);
> +    /* might need to redraw old window before switching (so cursor
> position
> +     * will be shown correctly on the old window) */
> +    update_topline();
>      /* may have to copy the buffer options when 'cpo' contains 'S' */
>      if (wp->w_buffer != curbuf)
>         buf_copy_options(wp->w_buffer, BCO_ENTER | BCO_NOHELP);
>

Maybe we also need to call do_check_scrollbind() and
do_check_cursorbind() for 'scrollbind' and 'cursorbind' option?

-- 
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui