patch 7.4.754
Problem: Using CTRL-A in Visual mode does not work well. (Gary Johnson)
Solution: Make it increment all numbers in the Visual area. (Christian
Brabandt)
diff --git a/src/normal.c b/src/normal.c
index 9c9537f..8d8be9b 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -4201,9 +4201,17 @@
nv_addsub(cap)
cmdarg_T *cap;
{
- if (!checkclearopq(cap->oap)
- && do_addsub((int)cap->cmdchar, cap->count1) == OK)
+ int visual = VIsual_active;
+ if (cap->oap->op_type == OP_NOP
+ && do_addsub((int)cap->cmdchar, cap->count1, cap->arg) == OK)
prep_redo_cmd(cap);
+ else
+ clearopbeep(cap->oap);
+ if (visual)
+ {
+ VIsual_active = FALSE;
+ redraw_later(CLEAR);
+ }
}
/*
@@ -7841,14 +7849,28 @@
switch (cap->nchar)
{
+ case Ctrl_A:
+ case Ctrl_X:
#ifdef MEM_PROFILE
/*
* "g^A": dump log of used memory.
*/
- case Ctrl_A:
- vim_mem_profile_dump();
- break;
+ if (!VIsual_active && cap->nchar == Ctrl_A)
+ vim_mem_profile_dump();
+ else
#endif
+ /*
+ * "g^A/g^X": sequentially increment visually selected region
+ */
+ if (VIsual_active)
+ {
+ cap->arg = TRUE;
+ cap->cmdchar = cap->nchar;
+ nv_addsub(cap);
+ }
+ else
+ clearopbeep(oap);
+ break;
#ifdef FEAT_VREPLACE
/*