Hi Bram and Vim developers,

I found a bit wrong cursor movement behavior.

Occurrence conditions (Match all):
  - 'virtualedit' option is 'block' or 'all'
  - 'wrap'
  - in Visual block mode
  - gj after $

How to reproduce.
1. Start Vim
  $ vim -N -u NONE

2. Set 'virtualedit' to 'block'
  :set ve=block

3. Prepare the test data
  i12345<CR>123<Esc>gg

4. Start Visual block mode and $ and gj
  :exe "normal! \<C-V>$gj"

Expected behavior
  Cursor move to lines:2 and columns:4.

Actual behavior
  Cursor move to lines:2 and columns:80.
  (The 80 is equal to 'columns')


I wrote a patch. (Of course, I also added a test :-)
Please check this.

Best regards,
Hirohito Higashi

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
diff -r 2f856c7c1d43 src/normal.c
--- a/src/normal.c	Sun Dec 15 10:02:33 2013 +0100
+++ b/src/normal.c	Sun Dec 22 03:11:58 2013 +0900
@@ -4644,7 +4644,10 @@
     }
 #endif
 
-    coladvance(curwin->w_curswant);
+    if (virtual_active() && atend)
+	coladvance(MAXCOL);
+    else
+	coladvance(curwin->w_curswant);
 
 #if defined(FEAT_LINEBREAK) || defined(FEAT_MBYTE)
     if (curwin->w_cursor.col > 0 && curwin->w_p_wrap)
diff -r 2f856c7c1d43 src/testdir/test39.in
--- a/src/testdir/test39.in	Sun Dec 15 10:02:33 2013 +0100
+++ b/src/testdir/test39.in	Sun Dec 22 03:11:58 2013 +0900
@@ -52,6 +52,12 @@
 G3o1234567892k05l2jr
G3o987652k02l2jr
 G3o1234567892k05l2jr
 G3o987652k02l2jr
+:"
+:" Test cursor position. When ve=block and Visual block mode and $gj
+:set ve=block
+:exe ":norm! 2k\<C-V>$gj\<Esc>"
+:let cpos=getpos("'>")
+:$put ='col:'.cpos[2].' off:'.cpos[3]
 :/^the/,$w >> test.out
 :qa!
 ENDTEST
diff -r 2f856c7c1d43 src/testdir/test39.ok
--- a/src/testdir/test39.ok	Sun Dec 15 10:02:33 2013 +0100
+++ b/src/testdir/test39.ok	Sun Dec 22 03:11:58 2013 +0900
@@ -43,3 +43,4 @@
 9865
 9865
 9865
+col:4 off:0

Raspunde prin e-mail lui