aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-10 06:45:27 +0800
committerGitHub <noreply@github.com>2022-04-10 06:45:27 +0800
commit12662ac0c4160b81f7875909d765cf8526bbdef2 (patch)
tree24019c5ad47540a08b5c49e32c4b6e5633674d9d /src/nvim/getchar.c
parent2a2c4e191f5c2cb70bafaa213b5697308dc6f850 (diff)
downloadrneovim-12662ac0c4160b81f7875909d765cf8526bbdef2.tar.gz
rneovim-12662ac0c4160b81f7875909d765cf8526bbdef2.tar.bz2
rneovim-12662ac0c4160b81f7875909d765cf8526bbdef2.zip
vim-patch:8.2.4722: ending recording with mapping records too much (#18060)
Problem: When a recording is ended with a mapped key that key is also recorded. Solution: Remember the previous last_recorded_len. (closes vim/vim#10122) https://github.com/vim/vim/commit/81b46a6ccd818609e1ca8cd410e26a58428c30ba
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index d615255828..85479b220a 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1469,8 +1469,14 @@ int vgetc(void)
mouse_row = old_mouse_row;
mouse_col = old_mouse_col;
} else {
+ // number of characters recorded from the last vgetc() call
+ static size_t last_vgetc_recorded_len = 0;
+
mod_mask = 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
bool did_inc = false;
@@ -1621,6 +1627,8 @@ int vgetc(void)
break;
}
+
+ last_vgetc_recorded_len = last_recorded_len;
}
/*