summaryrefslogtreecommitdiff
path: root/src/normal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-04-05 17:43:14 +0200
committerBram Moolenaar <Bram@vim.org>2013-04-05 17:43:14 +0200
commitd7fbfe107d57842e584cfb9093cad4cfd67ddb40 (patch)
tree04e9656885fa8b385169e93aa7f211cafaa06d99 /src/normal.c
parent91fc43d3f9d837e9ede66694c44e4cbcdc5c5549 (diff)
downloadvim-git-d7fbfe107d57842e584cfb9093cad4cfd67ddb40.tar.gz
updated for version 7.3.879v7.3.879
Problem: When using an ex command in operator pending mode, using Esc to abort the command still executes the operator. (David Bürgin) Solution: Clear the operator when the ex command fails. (Christian Brabandt)
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/normal.c b/src/normal.c
index d6c0abb11..181dbcb35 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -5418,6 +5418,7 @@ nv_colon(cap)
cmdarg_T *cap;
{
int old_p_im;
+ int cmd_result;
#ifdef FEAT_VISUAL
if (VIsual_active)
@@ -5449,7 +5450,7 @@ nv_colon(cap)
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 */
@@ -5461,12 +5462,17 @@ nv_colon(cap)
restart_edit = 0;
}
- /* The start of the operator may have become invalid by the Ex
- * command. */
- if (cap->oap->op_type != OP_NOP
+ if (cmd_result == FAIL)
+ /* The Ex command failed, do not execute the operator. */
+ clearop(cap->oap);
+ else 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))
+ || did_emsg
+ ))
+ /* The start of the operator has become invalid by the Ex command.
+ */
clearopbeep(cap->oap);
}
}