diff src/ops.c @ 26226:9a8e9383e4cd v8.2.3644

patch 8.2.3644: count for 'operatorfunc' in Visual mode is not redone Commit: https://github.com/vim/vim/commit/2228cd72cf7c6f326e4e41179e88d37595ca4abc Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 22 14:16:08 2021 +0000 patch 8.2.3644: count for 'operatorfunc' in Visual mode is not redone Problem: Count for 'operatorfunc' in Visual mode is not redone. Solution: Add the count to the redo buffer. (closes https://github.com/vim/vim/issues/9174)
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Nov 2021 15:30:08 +0100
parents 6b4f017d7005
children 294736db2561
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -3764,6 +3764,8 @@ do_pending_operator(cmdarg_T *cap, int o
 			    oap->motion_force, cap->cmdchar, cap->nchar);
 		else if (cap->cmdchar != ':' && cap->cmdchar != K_COMMAND)
 		{
+		    int opchar = get_op_char(oap->op_type);
+		    int extra_opchar = get_extra_op_char(oap->op_type);
 		    int nchar = oap->op_type == OP_REPLACE ? cap->nchar : NUL;
 
 		    // reverse what nv_replace() did
@@ -3771,10 +3773,14 @@ do_pending_operator(cmdarg_T *cap, int o
 			nchar = CAR;
 		    else if (nchar == REPLACE_NL_NCHAR)
 			nchar = NL;
-		    prep_redo(oap->regname, 0L, NUL, 'v',
-					get_op_char(oap->op_type),
-					get_extra_op_char(oap->op_type),
-					nchar);
+
+		    if (opchar == 'g' && extra_opchar == '@')
+			// also repeat the count for 'operatorfunc'
+			prep_redo_num2(oap->regname, 0L, NUL, 'v',
+				     cap->count0, opchar, extra_opchar, nchar);
+		    else
+			prep_redo(oap->regname, 0L, NUL, 'v',
+						  opchar, extra_opchar, nchar);
 		}
 		if (!redo_VIsual_busy)
 		{