mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-11 14:45:31 +03:00
Ensure event loop ticks ASAP when there is pending input
This commit is contained in:
parent
dd3d4f8451
commit
06dd84d6da
@ -443,7 +443,7 @@ do_parse(ChildMonitor *self, Screen *screen, monotonic_t now, bool flush) {
|
||||
if (screen->paused_rendering.expires_at) {
|
||||
set_maximum_wait(MAX(0, screen->paused_rendering.expires_at - now));
|
||||
} else set_maximum_wait(OPT(input_delay) - pd.time_since_new_input);
|
||||
}
|
||||
} else if (pd.has_pending_input) set_maximum_wait(OPT(input_delay) - pd.time_since_new_input);
|
||||
return pd.input_read;
|
||||
}
|
||||
|
||||
|
@ -1384,7 +1384,8 @@ run_worker(void *p, ParseData *pd, bool flush) {
|
||||
PS *self = (PS*)screen->vt_parser->state;
|
||||
with_lock {
|
||||
self->read.sz += self->write.pending; self->write.pending = 0;
|
||||
if (self->read.pos < self->read.sz) {
|
||||
pd->has_pending_input = self->read.pos < self->read.sz;
|
||||
if (pd->has_pending_input) {
|
||||
pd->time_since_new_input = pd->now - self->new_input_at;
|
||||
if (flush || pd->time_since_new_input >= OPT(input_delay) || self->read.sz + 16 * 1024 > BUF_SZ) {
|
||||
pd->input_read = true;
|
||||
|
@ -20,7 +20,7 @@ typedef struct ParseData {
|
||||
PyObject *dump_callback;
|
||||
monotonic_t now;
|
||||
|
||||
bool input_read, write_space_created;
|
||||
bool input_read, write_space_created, has_pending_input;
|
||||
monotonic_t time_since_new_input;
|
||||
} ParseData;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user