diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-07 14:27:47 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-04-07 21:42:11 +0800 |
commit | 64802da6c4304a2700d9471d17c0aae143d9aab1 (patch) | |
tree | dde71e2d365e1d1eb49453eaf83fd3e03efc2619 /src | |
parent | 2a574f7aaaf5cd0803faa9e4337bf3e21e8b8d2a (diff) | |
download | rneovim-64802da6c4304a2700d9471d17c0aae143d9aab1.tar.gz rneovim-64802da6c4304a2700d9471d17c0aae143d9aab1.tar.bz2 rneovim-64802da6c4304a2700d9471d17c0aae143d9aab1.zip |
fix(event-loop): check if executed register has ended
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/getchar.c | 2 | ||||
-rw-r--r-- | src/nvim/state.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 12c08baead..299385cb17 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2074,7 +2074,7 @@ void vungetc(int c) /// When peeking and not getting a character, reg_executing cannot be cleared /// yet, so set a flag to clear it later. -static void check_end_reg_executing(bool advance) +void check_end_reg_executing(bool advance) { if (reg_executing != 0 && (typebuf.tb_maplen == 0 || pending_end_reg_executing)) { if (advance) { diff --git a/src/nvim/state.c b/src/nvim/state.c index 3a7636085b..34e3ddf654 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -40,7 +40,7 @@ void state_enter(VimState *s) int key; getkey: - // Expand mappings first by calling vpeekc() directly. + // Apply mappings first by calling vpeekc() directly. // - If vpeekc() returns non-NUL, there is a character already available for processing, so // don't block for events. vgetc() may still block, in case of an incomplete UTF-8 sequence. // - If vpeekc() returns NUL, vgetc() will block, and there are three cases: @@ -76,6 +76,9 @@ getkey: } if (key == K_EVENT) { + // An event handler may use the value of reg_executing. + // Clear it if it should be cleared when getting the next character. + check_end_reg_executing(true); may_sync_undo(); } |