diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-09-27 11:56:38 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-10-01 15:22:49 -0300 |
commit | 0e4e69e52ec275370c3555bc18eb0a2d06b40898 (patch) | |
tree | f9875c562cac365b5c3c5961b8a2ca7dbc4d7a8e | |
parent | 1143b416ab7d8bb1707dab2be2cd9e191f9a03e4 (diff) | |
download | rneovim-0e4e69e52ec275370c3555bc18eb0a2d06b40898.tar.gz rneovim-0e4e69e52ec275370c3555bc18eb0a2d06b40898.tar.bz2 rneovim-0e4e69e52ec275370c3555bc18eb0a2d06b40898.zip |
os/input: Don't advance past incomplete sequences in input_enqueue
This allows callers to incrementally process buffers that are filled by
incomplete chunks more easily.
-rw-r--r-- | src/nvim/os/input.c | 9 |
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; } |