diff src/normal.c @ 15279:54457fc4af0b v8.1.0648

patch 8.1.0648: custom operators can't act upon a forced motion commit https://github.com/vim/vim/commit/5976f8ff00efcb3e155a89346e44f2ad43d2405a Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 27 23:44:44 2018 +0100 patch 8.1.0648: custom operators can't act upon a forced motion Problem: Custom operators can't act upon a forced motion. (Christian Wellenbrock) Solution: Add the forced motion to the mode() result. (Christian Brabandt, closes #3490)
author Bram Moolenaar <Bram@vim.org>
date Thu, 27 Dec 2018 23:45:05 +0100
parents db5d2429bda3
children 15e6f35b4223
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -1395,8 +1395,11 @@ do_pending_operator(cmdarg_T *cap, int o
 	else if (oap->motion_force == Ctrl_V)
 	{
 	    /* Change line- or characterwise motion into Visual block mode. */
-	    VIsual_active = TRUE;
-	    VIsual = oap->start;
+	    if (!VIsual_active)
+	    {
+		VIsual_active = TRUE;
+		VIsual = oap->start;
+	    }
 	    VIsual_mode = Ctrl_V;
 	    VIsual_select = FALSE;
 	    VIsual_reselect = FALSE;
@@ -2129,6 +2132,7 @@ do_pending_operator(cmdarg_T *cap, int o
 	}
 	oap->block_mode = FALSE;
 	clearop(oap);
+	motion_force = NUL;
     }
 #ifdef FEAT_LINEBREAK
     curwin->w_p_lbr = lbr_saved;
@@ -7689,7 +7693,7 @@ nv_visual(cmdarg_T *cap)
      * characterwise, linewise, or blockwise. */
     if (cap->oap->op_type != OP_NOP)
     {
-	cap->oap->motion_force = cap->cmdchar;
+	motion_force = cap->oap->motion_force = cap->cmdchar;
 	finish_op = FALSE;	/* operator doesn't finish now but later */
 	return;
     }