aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-12-14 09:20:07 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-01-12 09:47:40 -0300
commit0219c87534ff0770b95925529f8e89a2b6c34b14 (patch)
treec870e2348b46a8b92e1a412ae973d7670ea7b2ce /src
parentd50d79831e148d08406425a7bd672ccb55e2591b (diff)
downloadrneovim-0219c87534ff0770b95925529f8e89a2b6c34b14.tar.gz
rneovim-0219c87534ff0770b95925529f8e89a2b6c34b14.tar.bz2
rneovim-0219c87534ff0770b95925529f8e89a2b6c34b14.zip
input: Ignore invalid "<" key sequences
Ignoring invalid key sequences simplifies input handling in UIs. The only downside is having to use "<lt>" everytime a "<" is needed on functional tests.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/os/input.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index c0d588f4ef..130e239a34 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -187,14 +187,20 @@ size_t input_enqueue(String keys)
unsigned int new_size = trans_special((uint8_t **)&ptr, buf, false);
if (!new_size) {
+ if (*ptr == '<') {
+ // Invalid key sequence, skip until the next '>' or until *end
+ do {
+ ptr++;
+ } while (ptr < end && *ptr != '>');
+ ptr++;
+ continue;
+ }
// copy the character unmodified
*buf = (uint8_t)*ptr++;
new_size = 1;
}
new_size = handle_mouse_event(&ptr, buf, new_size);
- // TODO(tarruda): Don't produce past unclosed '<' characters, except if
- // there's a lot of characters after the '<'
rbuffer_write(input_buffer, (char *)buf, new_size);
}