Hi glts!

On Mi, 27 Mär 2013, glts wrote:

> In Operator-pending mode it is possible to use Ex commands to move the
> cursor. When editing the command-line in this situation, <Esc> normally
> aborts the whole operation. For example, in normal mode:
> 
>     d:call<Esc>
> 
> This command has no effect.

But it doesn't really abort.

> 
> But when a "motion force" has been given before entering the
> command-line, the command cannot be aborted. To reproduce, again in
> normal mode:
> 
>     dv:call<Esc>
>     dV:call<Esc>
> 
> These commands delete one character and one line respectively.

Here is a patch, that checks, whether the ex command could be executed 
and also whether the command possibly generated an error.

regards,
Christian
-- 

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


diff --git a/src/normal.c b/src/normal.c
--- a/src/normal.c
+++ b/src/normal.c
@@ -5418,6 +5418,7 @@
     cmdarg_T  *cap;
 {
     int	    old_p_im;
+    int	    cmd_result;
 
 #ifdef FEAT_VISUAL
     if (VIsual_active)
@@ -5449,7 +5450,7 @@
 	old_p_im = p_im;
 
 	/* get a command line and execute it */
-	do_cmdline(NULL, getexline, NULL,
+	cmd_result = do_cmdline(NULL, getexline, NULL,
 			    cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0);
 
 	/* If 'insertmode' changed, enter or exit Insert mode */
@@ -5466,7 +5467,10 @@
 	if (cap->oap->op_type != OP_NOP
 		&& (cap->oap->start.lnum > curbuf->b_ml.ml_line_count
 		    || cap->oap->start.col >
-			       (colnr_T)STRLEN(ml_get(cap->oap->start.lnum))))
+			       (colnr_T)STRLEN(ml_get(cap->oap->start.lnum))
+		    || cmd_result == FAIL
+		    || did_emsg
+		    ))
 	    clearopbeep(cap->oap);
     }
 }

Raspunde prin e-mail lui