aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/getchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r--src/nvim/getchar.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 5c1366c5b2..2e584e7cff 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -1147,6 +1147,13 @@ static void gotchars(const uint8_t *chars, size_t len)
maptick++;
}
+/// Record a <Nop> key.
+void gotchars_nop(void)
+{
+ uint8_t nop_buf[3] = { K_SPECIAL, KS_EXTRA, KE_NOP };
+ gotchars(nop_buf, 3);
+}
+
/// Undo the last gotchars() for "len" bytes. To be used when putting a typed
/// character back into the typeahead buffer, thus gotchars() will be called
/// again.
@@ -2745,14 +2752,9 @@ static int vgetorpeek(bool advance)
}
if (timedout && c == ESC) {
- uint8_t nop_buf[3];
-
// When recording there will be no timeout. Add a <Nop> after the ESC
// to avoid that it forms a key code with following characters.
- nop_buf[0] = K_SPECIAL;
- nop_buf[1] = KS_EXTRA;
- nop_buf[2] = KE_NOP;
- gotchars(nop_buf, 3);
+ gotchars_nop();
}
vgetc_busy--;