Re: [patch] Fixes bug in cursorbind feature when ve=all

2012-03-10 Fir de Conversatie Bram Moolenaar

Gary Johnson wrote:

 There is a bug in the 'cursorbind' feature of Vim 7.3.470 when
 'virtualedit' is all.  The cursor position in the inactive
 window(s) is supposed to track the cursor position in the active
 window so that when one of the inactive windows is entered, the
 cursor position in that window will match the position in the
 previous active window.
 
 What happens instead is that if the user has been moving the cursor
 around in the region to the right of the ends of the lines, entering
 another window will cause the cursor to jump to a column far to the
 right of the correct column, often to a column number in the
 hundreds or thousands.
 
 One way to observe this bug is with the following command.
 
 vim -O2 -N -u NONE -c 'set ruler' -c 'windo set cursorbind ve=all' -c 
 'normal Iline'
 
 Scroll the cursor back and forth in the empty region to the right of
 line and observe the rulers in the two status lines.  The column
 number in the right window will accurately follow the cursor
 position while the column number in the left window will continually
 increase.
 
 When Vim updates the cursor location, it keeps separate values for
 where the cursor would be in the actual line and where it is in the
 virtual line.  One of Vim's functions was not properly copying
 this latter value from the active window to the inactive windows.
 The attached patch fixes this problem.
 
 The patch is in two formats.  The move.c.hgdiff file is the output
 of hg diff and the move.c.diff-c file is a context diff.

Thanks, I'll look into it soon.

-- 
Keep America beautiful.  Swallow your beer cans.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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///

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


[patch] Fixes bug in cursorbind feature when ve=all

2012-03-09 Fir de Conversatie Gary Johnson
There is a bug in the 'cursorbind' feature of Vim 7.3.470 when
'virtualedit' is all.  The cursor position in the inactive
window(s) is supposed to track the cursor position in the active
window so that when one of the inactive windows is entered, the
cursor position in that window will match the position in the
previous active window.

What happens instead is that if the user has been moving the cursor
around in the region to the right of the ends of the lines, entering
another window will cause the cursor to jump to a column far to the
right of the correct column, often to a column number in the
hundreds or thousands.

One way to observe this bug is with the following command.

vim -O2 -N -u NONE -c 'set ruler' -c 'windo set cursorbind ve=all' -c 
'normal Iline'

Scroll the cursor back and forth in the empty region to the right of
line and observe the rulers in the two status lines.  The column
number in the right window will accurately follow the cursor
position while the column number in the left window will continually
increase.

When Vim updates the cursor location, it keeps separate values for
where the cursor would be in the actual line and where it is in the
virtual line.  One of Vim's functions was not properly copying
this latter value from the active window to the inactive windows.
The attached patch fixes this problem.

The patch is in two formats.  The move.c.hgdiff file is the output
of hg diff and the move.c.diff-c file is a context diff.

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
diff -r b3ccae22bae7 src/move.c
--- a/src/move.cWed Mar 07 22:55:21 2012 +0100
+++ b/src/move.cFri Mar 09 18:23:52 2012 -0800
@@ -2844,6 +2844,7 @@
 {
 linenr_T   line = curwin-w_cursor.lnum;
 colnr_Tcol =  curwin-w_cursor.col;
+colnr_Tcoladd = curwin-w_cursor.coladd;
 win_T  *old_curwin = curwin;
 buf_T  *old_curbuf = curbuf;
 intrestart_edit_save;
@@ -2875,6 +2876,7 @@
 # endif
curwin-w_cursor.lnum = line;
curwin-w_cursor.col = col;
+   curwin-w_cursor.coladd = coladd;
 
/* Make sure the cursor is in a valid position.  Temporarily set
 * restart_edit to allow the cursor to be beyond the EOL. */
*** -   2012-03-09 18:23:03.407497626 -0800
--- move.c  2012-03-09 10:47:07.075133000 -0800
***
*** 2844,2849 
--- 2844,2850 
  {
  linenr_T  line = curwin-w_cursor.lnum;
  colnr_T   col =  curwin-w_cursor.col;
+ colnr_T   coladd = curwin-w_cursor.coladd;
  win_T *old_curwin = curwin;
  buf_T *old_curbuf = curbuf;
  int   restart_edit_save;
***
*** 2875,2880 
--- 2876,2882 
  # endif
curwin-w_cursor.lnum = line;
curwin-w_cursor.col = col;
+   curwin-w_cursor.coladd = coladd;
  
/* Make sure the cursor is in a valid position.  Temporarily set
 * restart_edit to allow the cursor to be beyond the EOL. */