Hi Ingo!

On Mi, 20 Nov 2013, Ingo Karkat wrote:

> Hello Vim developers,
> 
> the automated test suite of one of my plugins caught a regression, caused by
> 
> ,----[ patch 7.4.034 ]----
> | using "p" in Visual block mode only changes the first line
> `----
> 
> The steps to reproduce are a bit strange, but not unusual when used in a
> plugin. It's based on pasting over a characterwise visual selection that
> ends at the end of the current line via "p" while :set virtualedit=all,
> then clearing virtualedit. I've used the attached script with "hg
> bisect"; it'll exit with 1 when the bug is present.

I am not sure, why this didn't happen before that patch, but I think 
this is caused by Vim thinking the cursor didn't move. Basically Vim 
caches the last known position and in this case, since the cursor after 
the put ends up on the same column as before ('e' movement) it doesn't 
call update_virtcol(), which in turns causes resetting of the cursor 
once you reset 've'.

As said, I don't know why this didn't happen before patch 7.4.34, since 
that patch basically only adds a loop around the paste operation and 
doesn't change anything about the cursor positioning.

Here is a patch, that prevents the behaviour.

diff --git a/src/ops.c b/src/ops.c
--- a/src/ops.c
+++ b/src/ops.c
@@ -3818,7 +3818,11 @@
                    ml_replace(lnum, newp, FALSE);
                    /* Place cursor on last putted char. */
                    if (lnum == curwin->w_cursor.lnum)
+                   {
+                       /* make sure curwin->w_virtcol is updated */
+                       curwin->w_valid_cursor.col = curwin->w_cursor.col;
                        curwin->w_cursor.col += (colnr_T)(totlen - 1);
+                   }
                }
 #ifdef FEAT_VISUAL
                if (VIsual_active)


Best,
Christian
-- 
Wie man sein Kind nicht nennen sollte: 
  Reiner Wahnsinn 

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

Raspunde prin e-mail lui