mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
input_enqueue(): Fix length calculation. (#5981)
Ref: https://github.com/neovim/neovim/issues/5885#issuecomment-273614373
This commit is contained in:
parent
4b2759b6da
commit
030349d852
@ -170,12 +170,13 @@ bool os_isatty(int fd)
|
||||
|
||||
size_t input_enqueue(String keys)
|
||||
{
|
||||
char *ptr = keys.data, *end = ptr + keys.size;
|
||||
char *ptr = keys.data;
|
||||
char *end = ptr + keys.size;
|
||||
|
||||
while (rbuffer_space(input_buffer) >= 6 && ptr < end) {
|
||||
uint8_t buf[6] = { 0 };
|
||||
unsigned int new_size = trans_special((const uint8_t **)&ptr, keys.size,
|
||||
buf, true);
|
||||
unsigned int new_size
|
||||
= trans_special((const uint8_t **)&ptr, (size_t)(end - ptr), buf, true);
|
||||
|
||||
if (new_size) {
|
||||
new_size = handle_mouse_event(&ptr, buf, new_size);
|
||||
@ -185,8 +186,7 @@ size_t input_enqueue(String keys)
|
||||
|
||||
if (*ptr == '<') {
|
||||
char *old_ptr = ptr;
|
||||
// Invalid or incomplete key sequence, skip until the next '>' or until
|
||||
// *end
|
||||
// Invalid or incomplete key sequence, skip until the next '>' or *end.
|
||||
do {
|
||||
ptr++;
|
||||
} while (ptr < end && *ptr != '>');
|
||||
|
Loading…
Reference in New Issue
Block a user