mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.
This commit is contained in:
parent
1143b416ab
commit
0e4e69e52e
@ -171,10 +171,17 @@ size_t input_enqueue(String keys)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr == '<') {
|
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 {
|
do {
|
||||||
ptr++;
|
ptr++;
|
||||||
} while (ptr < end && *ptr != '>');
|
} while (ptr < end && *ptr != '>');
|
||||||
|
if (*ptr != '>') {
|
||||||
|
// Incomplete key sequence, return without consuming.
|
||||||
|
ptr = old_ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user