summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-09 17:58:49 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-09 17:58:49 +0100
commit81b46a6ccd818609e1ca8cd410e26a58428c30ba (patch)
treec1fabec0ac2a5470e3e347ebb5a873bb2243b629 /src/getchar.c
parent36951ed1dab2b2e816dc8959c72b5732f36d9e3b (diff)
patch 8.2.4722: ending recording with mapping records too muchv8.2.4722
Problem: When a recording is ended with a mapped key that key is also recorded. Solution: Remember the previous last_recorded_len. (closes #10122)
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 29ad56e6a1..fb7f00a95f 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1705,10 +1705,16 @@ vgetc(void)
}
else
{
+ // number of characters recorded from the last vgetc() call
+ static int last_vgetc_recorded_len = 0;
+
mod_mask = 0;
vgetc_mod_mask = 0;
vgetc_char = 0;
- last_recorded_len = 0;
+
+ // last_recorded_len can be larger than last_vgetc_recorded_len
+ // if peeking records more
+ last_recorded_len -= last_vgetc_recorded_len;
for (;;) // this is done twice if there are modifiers
{
@@ -1910,6 +1916,8 @@ vgetc(void)
break;
}
+
+ last_vgetc_recorded_len = last_recorded_len;
}
#ifdef FEAT_EVAL