mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.
This commit is contained in:
parent
17b211d288
commit
3e83e44792
@ -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);
|
||||
}
|
||||
|
||||
|
@ -23,18 +23,18 @@ describe('visual block shift and tab characters', function()
|
||||
abcdefghijklmnopqrstuvwxyz]])
|
||||
|
||||
feed('gg')
|
||||
feed([[fe<C-v>4jR<esc>ugvr1:'<,'>yank A<cr>]])
|
||||
feed([[fe<C-v>4jR<esc>ugvr1:'<lt>,'>yank A<cr>]])
|
||||
execute('/^abcdefgh')
|
||||
feed('<C-v>4jI <esc>j<<11|D')
|
||||
feed('<C-v>4jI <esc>j<lt><lt>11|D')
|
||||
feed('j7|a <esc>')
|
||||
feed('j7|a <esc>')
|
||||
feed('j7|a <esc>4k13|<C-v>4j<')
|
||||
feed('j7|a <esc>4k13|<C-v>4j<lt>')
|
||||
execute('$-5,$yank A')
|
||||
execute([[$-4,$s/\s\+//g]])
|
||||
feed('<C-v>4kI <esc>j<<')
|
||||
feed('<C-v>4kI <esc>j<lt><lt>')
|
||||
feed('j7|a <esc>')
|
||||
feed('j7|a <esc>')
|
||||
feed('j7|a <esc>4k13|<C-v>4j3<')
|
||||
feed('j7|a <esc>4k13|<C-v>4j3<lt>')
|
||||
execute('$-4,$yank A')
|
||||
|
||||
-- Put @a and clean empty lines
|
||||
|
Loading…
Reference in New Issue
Block a user