Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.879
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.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)
Files:	    src/normal.c


*** ../vim-7.3.878/src/normal.c	2013-03-16 14:20:45.000000000 +0100
--- src/normal.c	2013-04-05 16:54:13.000000000 +0200
***************
*** 5418,5423 ****
--- 5418,5424 ----
      cmdarg_T  *cap;
  {
      int	    old_p_im;
+     int	    cmd_result;
  
  #ifdef FEAT_VISUAL
      if (VIsual_active)
***************
*** 5449,5455 ****
  	old_p_im = p_im;
  
  	/* get a command line and execute it */
! 	do_cmdline(NULL, getexline, NULL,
  			    cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0);
  
  	/* If 'insertmode' changed, enter or exit Insert mode */
--- 5450,5456 ----
  	old_p_im = p_im;
  
  	/* get a command line and execute it */
! 	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,5472 ****
  		restart_edit = 0;
  	}
  
! 	/* The start of the operator may have become invalid by the Ex
! 	 * command. */
! 	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))))
  	    clearopbeep(cap->oap);
      }
  }
--- 5462,5478 ----
  		restart_edit = 0;
  	}
  
! 	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))
! 		    || did_emsg
! 		    ))
! 	    /* The start of the operator has become invalid by the Ex command.
! 	     */
  	    clearopbeep(cap->oap);
      }
  }
*** ../vim-7.3.878/src/version.c	2013-04-05 15:39:41.000000000 +0200
--- src/version.c	2013-04-05 16:56:43.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
  {   /* Add new patch number below this line */
+ /**/
+     879,
  /**/

-- 
~
~
~
".signature" 4 lines, 50 characters written

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///