aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/os/input.c')
-rw-r--r--src/nvim/os/input.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 09f162f79d..e2cff2f9c0 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -171,10 +171,17 @@ size_t input_enqueue(String keys)
}
if (*ptr == '<') {
- // Invalid key sequence, skip until the next '>' or until *end
+ char *old_ptr = ptr;
+ // Invalid or incomplete key sequence, skip until the next '>' or until
+ // *end
do {
ptr++;
} while (ptr < end && *ptr != '>');
+ if (*ptr != '>') {
+ // Incomplete key sequence, return without consuming.
+ ptr = old_ptr;
+ break;
+ }
ptr++;
continue;
}