From d8c0e7f8cb79ade91a0c021a80428e90dcabfbb9 Mon Sep 17 00:00:00 2001 From: echobt Date: Thu, 5 Feb 2026 11:11:42 +0000 Subject: [PATCH] fix(tui): prevent End hint showing when already at bottom MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scroll_chat method was unconditionally setting chat_scroll_pinned_bottom to false, which caused the '↓ End' hint to incorrectly appear when: - Scrolling down while already at the bottom - Pressing End key while at the bottom Now we check if chat_scroll is 0 (at bottom) after the scroll operation and keep pinned_bottom=true in that case. --- src/cortex-tui/src/app/state.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cortex-tui/src/app/state.rs b/src/cortex-tui/src/app/state.rs index ba72ede2..d79a5f91 100644 --- a/src/cortex-tui/src/app/state.rs +++ b/src/cortex-tui/src/app/state.rs @@ -518,7 +518,9 @@ impl AppState { } else { self.chat_scroll = self.chat_scroll.saturating_add(delta as usize); } - self.chat_scroll_pinned_bottom = false; + // Only unpin from bottom if we actually scrolled away from it + // When chat_scroll is 0, we're at the bottom, so keep pinned + self.chat_scroll_pinned_bottom = self.chat_scroll == 0; self.show_scrollbar(); }