From dbc4b987427492d2517bd6c7532ec97e434f2b4a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 9 Nov 2023 22:44:06 +0530 Subject: [PATCH] Ignore input_delay when the input buffer is close to full --- kitty/options/definition.py | 2 +- kitty/vt-parser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/options/definition.py b/kitty/options/definition.py index 65f829dc0..89df6b82f 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -867,7 +867,7 @@ Delay before input from the program running in the terminal is processed (in milliseconds). Note that decreasing it will increase responsiveness, but also increase CPU usage and might cause flicker in full screen programs that redraw the entire screen on each loop, because kitty is so fast that partial screen -updates will be drawn. +updates will be drawn. This setting is ignored when the input buffer is almost full. ''' ) diff --git a/kitty/vt-parser.c b/kitty/vt-parser.c index df3589a91..59c4f0a92 100644 --- a/kitty/vt-parser.c +++ b/kitty/vt-parser.c @@ -1611,7 +1611,7 @@ run_worker(void *p, ParseData *pd, bool flush) { if (self->read.consumed < self->read.sz) { self->dump_callback = pd->dump_callback; self->now = pd->now; pd->time_since_new_input = pd->now - self->new_input_at; - if (flush || pd->time_since_new_input >= OPT(input_delay)) { + if (flush || pd->time_since_new_input >= OPT(input_delay) || (BUF_SZ - self->read.sz) <= 16 * 1024) { bool buf_full = self->read.sz >= BUF_SZ; pd->input_read = true; do_parse_vt(self);