There is a bug in Vim's tracking of the wanted cursor column in the
cursorbind feature.  I believe that the attached patch fixes it.

Vim keeps track of the desired or wanted cursor column as well as
the actual cursor column.  When the user moves the cursor to a
different line and the wanted cursor column value is not stale, Vim
tries to move the cursor to that wanted column.  When 'cursorbind'
is set, that wanted cursor column information is not being copied
from the active window to the other cursorbound windows, resulting
in the cursor jumping to seemingly random columns when moving the
cursor up or down following a jump to a different window.

To demonstrate this, start vim as "vim -N -u NONE" and execute the
following.

    :set cursorbind
    a123456789<Esc>
    Yp
    :vnew
    PP

Now move the cursor to column 5 and move the cursor to the other
window:

    4l
    <C-W><C-W>

The cursor will be at column 5 of the other window, as expected.
Now move the cursor to column 6 and move back to the original
window.

    l
    <C-W><C-W>

The cursor will be at column 6, again as expected.  Now move the
cursor down a line.

    j

The cursor will move to row 2 but to column 5 instead of column 6.

Regards,
Gary

-- 
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
*** -	2012-03-26 10:46:17.264254238 -0700
--- src/move.c	2012-03-23 13:49:00.146246000 -0700
***************
*** 2847,2852 ****
--- 2847,2854 ----
  # ifdef FEAT_VIRTUALEDIT
      colnr_T	coladd = curwin->w_cursor.coladd;
  # endif
+     colnr_T	curswant = curwin->w_curswant;
+     int		set_curswant = curwin->w_set_curswant;
      win_T	*old_curwin = curwin;
      buf_T	*old_curbuf = curbuf;
      int		restart_edit_save;
***************
*** 2881,2886 ****
--- 2883,2890 ----
  # ifdef FEAT_VIRTUALEDIT
  	    curwin->w_cursor.coladd = coladd;
  # endif
+ 	    curwin->w_curswant = curswant;
+ 	    curwin->w_set_curswant = set_curswant;
  
  	    /* Make sure the cursor is in a valid position.  Temporarily set
  	     * "restart_edit" to allow the cursor to be beyond the EOL. */

Raspunde prin e-mail lui