summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2008-07-31 20:04:27 +0000
committerBram Moolenaar <Bram@vim.org>2008-07-31 20:04:27 +0000
commita983fe94738e66b8f6a08244ef6dc45ddf5b622f (patch)
treef674402472a5cb99cda3204f4b5bde3e0f3b2032
parent2bf6a2d7818bff5620ac47d99eaafd1b62a003e5 (diff)
updated for version 7.2b-025v7.2b.025
-rw-r--r--src/normal.c56
-rw-r--r--src/structs.h4
-rw-r--r--src/version.c2
3 files changed, 51 insertions, 11 deletions
diff --git a/src/normal.c b/src/normal.c
index a1b3a945f4..eb03a6a6de 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -581,6 +581,10 @@ normal_cmd(oap, toplevel)
vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
ca.oap = oap;
+
+ /* Use a count remembered from before entering an operator. After typing
+ * "3d" we return from normal_cmd() and come back here, the "3" is
+ * remembered in "opcount". */
ca.opcount = opcount;
#ifdef FEAT_SNIFF
@@ -606,9 +610,24 @@ normal_cmd(oap, toplevel)
}
#endif
+ /* When not finishing an operator and no register name typed, reset the
+ * count. */
if (!finish_op && !oap->regname)
ca.opcount = 0;
+#ifdef FEAT_AUTOCMD
+ /* Restore counts from before receiving K_CURSORHOLD. This means after
+ * typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not
+ * "3 * 2". */
+ if (oap->prev_opcount > 0 || oap->prev_count0 > 0)
+ {
+ ca.opcount = oap->prev_opcount;
+ ca.count0 = oap->prev_count0;
+ oap->prev_opcount = 0;
+ oap->prev_count0 = 0;
+ }
+#endif
+
#ifdef FEAT_VISUAL
mapped_len = typebuf_maplen();
#endif
@@ -744,16 +763,27 @@ getcount:
}
}
- /*
- * If we're in the middle of an operator (including after entering a yank
- * buffer with '"') AND we had a count before the operator, then that
- * count overrides the current value of ca.count0.
- * What this means effectively, is that commands like "3dw" get turned
- * into "d3w" which makes things fall into place pretty neatly.
- * If you give a count before AND after the operator, they are multiplied.
- */
- if (ca.opcount != 0)
+#ifdef FEAT_AUTOCMD
+ if (c == K_CURSORHOLD)
{
+ /* Save the count values so that ca.opcount and ca.count0 are exactly
+ * the same when coming back here after handling K_CURSORHOLD. */
+ oap->prev_opcount = ca.opcount;
+ oap->prev_count0 = ca.count0;
+ }
+ else
+#endif
+ if (ca.opcount != 0)
+ {
+ /*
+ * If we're in the middle of an operator (including after entering a
+ * yank buffer with '"') AND we had a count before the operator, then
+ * that count overrides the current value of ca.count0.
+ * What this means effectively, is that commands like "3dw" get turned
+ * into "d3w" which makes things fall into place pretty neatly.
+ * If you give a count before AND after the operator, they are
+ * multiplied.
+ */
if (ca.count0)
ca.count0 *= ca.opcount;
else
@@ -798,7 +828,7 @@ getcount:
if (text_locked() && (nv_cmds[idx].cmd_flags & NV_NCW))
{
- /* This command is not allowed wile editing a ccmdline: beep. */
+ /* This command is not allowed while editing a ccmdline: beep. */
clearopbeep(oap);
text_locked_msg();
goto normal_end;
@@ -1274,7 +1304,11 @@ normal_end:
#endif
#ifdef FEAT_CMDL_INFO
- if (oap->op_type == OP_NOP && oap->regname == 0)
+ if (oap->op_type == OP_NOP && oap->regname == 0
+# ifdef FEAT_AUTOCMD
+ && ca.cmdchar != K_CURSORHOLD
+# endif
+ )
clear_showcmd();
#endif
diff --git a/src/structs.h b/src/structs.h
index 31c3dfc2dc..a485ec15c3 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -2076,6 +2076,10 @@ typedef struct oparg_S
#endif
colnr_T start_vcol; /* start col for block mode operator */
colnr_T end_vcol; /* end col for block mode operator */
+#ifdef FEAT_AUTOCMD
+ long prev_opcount; /* ca.opcount saved for K_CURSORHOLD */
+ long prev_count0; /* ca.count0 saved for K_CURSORHOLD */
+#endif
} oparg_T;
/*
diff --git a/src/version.c b/src/version.c
index 4d2baa4265..b42aec7308 100644
--- a/src/version.c
+++ b/src/version.c
@@ -677,6 +677,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 25,
+/**/
24,
/**/
23,