summaryrefslogtreecommitdiff
path: root/src/normal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-06-25 13:57:36 +0200
committerBram Moolenaar <Bram@vim.org>2015-06-25 13:57:36 +0200
commit3a304b23823b089e499063e8211c5695d049f3ba (patch)
tree32c354f574f5ac9d51d7bcccb43c8c6604669300 /src/normal.c
parent74db34cc9162445e3d500ab2d61c5c19ce9af0ca (diff)
downloadvim-git-3a304b23823b089e499063e8211c5695d049f3ba.tar.gz
patch 7.4.754v7.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)
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/normal.c b/src/normal.c
index 9c9537f4b..8d8be9b0c 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -4201,9 +4201,17 @@ nv_help(cap)
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 @@ nv_g_cmd(cap)
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
/*