Skip to content

Commit 9dd5384

Browse files
authored
fix(tui): reset scroll state when clearing messages (#504)
When messages are cleared with /clear or similar commands, the scroll state was not being properly reset. This caused two bugs: 1. The '↓ End' scroll hint would incorrectly appear after clearing because chat_scroll_pinned_bottom was not reset to true 2. The TaskRunning hints (Esc to interrupt) could show incorrectly because the scroll state was stale Fixed by setting chat_scroll_pinned_bottom = true in clear_messages() to ensure the UI correctly reflects that we're at the bottom of the (now empty) message list.
1 parent 72ddeae commit 9dd5384

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cortex-tui/src/app.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,8 @@ impl AppState {
890890
pub fn clear_messages(&mut self) {
891891
self.messages.clear();
892892
self.chat_scroll = 0;
893+
// Reset scroll state to bottom (no "↓ End" hint after clearing)
894+
self.chat_scroll_pinned_bottom = true;
893895
// Request clearing terminal scrollback buffer for privacy
894896
self.pending_scrollback_clear = true;
895897
}

0 commit comments

Comments
 (0)