On Mi, 29 Jan 2014, Christian Wellenbrock wrote: > On Wednesday, January 29, 2014 3:51:25 PM UTC+1, glts wrote: > > On Wed, Jan 29, 2014 at 1:09 PM, Christian Wellenbrock > > > > wrote: > >
> > > Here is a small example to illustrate the issue: echo 123456789 | > > > vim - +":omap a0 :<C-U>execute 'norm 0v'.v:count1.'lh'<CR>" This > > > invocation puts the string "123456789" into a new buffer and > > > creates an operator-pending mapping `a0` that selects the first > > > characters of the current line for the pending operator. > > > > > > Executing `3da0` deletes the first three characters of the line, > > > leaving us with the following buffer contents: > > > 456789 > > > > > > Repeating that last command with `.` should now delete the first > > > three characters again, leading to this: > > > expected: 789 > > > > > > Instead the count seems to be reset to 1, leading to this: > > > obtained: 56789 > > > > > For comparison: Repeating `3x` with `.` deletes another three > > > characters, instead of just one. This seems inconsistent. > > > > > > > > Sounds familiar, I think this was reported here before. Here's a > > link: > > https://groups.google.com/d/msg/vim_dev/ghN72ZqmMQU/fveKSIdzxhQJ > > Though to be honest I don't remember the details. I think, this happens, because by the time, the redo is executed, the v:count variable is reset to its initial value. Here is a simple patch, that initializes the v:count variables when the ':' command is used, but it might have unwanted consequences: diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -5458,6 +5458,9 @@ old_p_im = p_im; +#ifdef FEAT_EVAL + set_vcount(cap->count0, cap->count1, TRUE); +#endif /* get a command line and execute it */ cmd_result = do_cmdline(NULL, getexline, NULL, cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0); Best, Christian -- Women can keep a secret just as well as men, but it takes more of them to do it. -- -- 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.
