From ae50735311d2ebc8d235c0187737cce3d4f7ed4c Mon Sep 17 00:00:00 2001 From: deepend Date: Tue, 17 Feb 2026 14:49:15 -0700 Subject: [PATCH] =?UTF-8?q?Identified=20and=20fixed=20an=20obvious=20UI-pa?= =?UTF-8?q?th=20delay=20in=20message=20rendering:=20when=20a=20new=20line?= =?UTF-8?q?=20is=20appended=20and=20the=20user=20is=20already=20at=20the?= =?UTF-8?q?=20bottom=20of=20the=20channel=20buffer=20(scrollbar=5Fdown),?= =?UTF-8?q?=20the=20code=20now=20renders=20immediately=20instead=20of=20al?= =?UTF-8?q?ways=20waiting=20for=20an=20idle=20callback.=20This=20removes?= =?UTF-8?q?=20the=20subtle=20=E2=80=9Csent=20but=20appears=20a=20moment=20?= =?UTF-8?q?later=E2=80=9D=20effect=20in=20large-scrollback=20channels.=20P?= =?UTF-8?q?reserved=20the=20previous=20idle-batched=20behavior=20for=20use?= =?UTF-8?q?rs=20who=20are=20not=20at=20the=20bottom=20(scrolling=20history?= =?UTF-8?q?),=20so=20performance-friendly=20deferred=20redraws=20still=20a?= =?UTF-8?q?pply=20in=20that=20case.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fe-gtk/xtext.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index aff3b989..02e334d5 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -5426,11 +5426,16 @@ gtk_xtext_append_entry (xtext_buffer *buf, textentry * ent, time_t stamp) g_source_remove (buf->xtext->io_tag); buf->xtext->io_tag = 0; } - /* Render new lines as soon as the UI is idle to avoid a noticeable - * delay between pressing Enter and seeing your own message. */ - buf->xtext->add_io_tag = g_idle_add ((GSourceFunc) - gtk_xtext_render_page_timeout, - buf->xtext); + /* When at the bottom of the buffer, render immediately so long + * scrollback doesn't delay newly-sent messages appearing. + * Otherwise, keep idle batching to avoid extra redraws while + * scrolling around old content. */ + if (buf->scrollbar_down) + gtk_xtext_render_page_timeout (buf->xtext); + else + buf->xtext->add_io_tag = g_idle_add ((GSourceFunc) + gtk_xtext_render_page_timeout, + buf->xtext); } } if (buf->scrollbar_down)