From 138ea3242c892aea2b53caf3f7f5c558c031f523 Mon Sep 17 00:00:00 2001 From: RestartFU Date: Tue, 28 Jul 2026 10:56:32 -0400 Subject: [PATCH] fix(chat): keep following after a wheel at the bottom Any wheel movement dropped bottom following, including one the transcript could not act on. Rolling down while already at the bottom -- how someone checks they are there -- left the value untouched, so the signal that puts following back never arrived and new output stopped arriving on screen. Release only on an upward wheel with room above to travel. Closes #114 Co-Authored-By: Claude Opus 5 --- src/chat/chat-view.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/chat/chat-view.c b/src/chat/chat-view.c index 62f48d76..171aea59 100644 --- a/src/chat/chat-view.c +++ b/src/chat/chat-view.c @@ -532,6 +532,14 @@ on_scroll_adjustment_changed (GtkAdjustment *adjustment, } } +/* + * A wheel that cannot move the transcript is not a decision to stop following + * it. Rolling down while already at the bottom is how someone checks they are + * there, and rolling up against the top of a short chat does nothing at all; + * neither changes the value, so nothing would ever put following back. + * + * Only leaving the bottom does, and only upwards, with somewhere to go. + */ static gboolean on_transcript_scrolled (GtkEventControllerScroll *controller, double dx, @@ -539,8 +547,12 @@ on_transcript_scrolled (GtkEventControllerScroll *controller, gpointer user_data) { XdChatView *self = user_data; + GtkAdjustment *adjustment = + gtk_scrolled_window_get_vadjustment (self->scroller); - if (dy != 0) + if (dy < 0 && + gtk_adjustment_get_value (adjustment) > + gtk_adjustment_get_lower (adjustment)) { self->follow_bottom = FALSE; self->history_bottom_distance = -1;