From d7fbfe107d57842e584cfb9093cad4cfd67ddb40 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 5 Apr 2013 17:43:14 +0200 Subject: =?UTF-8?q?updated=20for=20version=207.3.879=20Problem:=20=20=20?= =?UTF-8?q?=20When=20using=20an=20ex=20command=20in=20operator=20pending?= =?UTF-8?q?=20mode,=20using=20Esc=20to=20=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20abort=20the=20command=20still=20executes=20the=20operator.?= =?UTF-8?q?=20(David=20B=C3=BCrgin)=20Solution:=20=20=20Clear=20the=20oper?= =?UTF-8?q?ator=20when=20the=20ex=20command=20fails.=20(Christian=20Braban?= =?UTF-8?q?dt)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/normal.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/normal.c') 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); } } -- cgit v1.2.1