tui: gate Up/Down history navigation to only when history view is not scrollable (last_max_scroll == 0); avoid dual behavior with chat scrolling

This commit is contained in:
James Peter
2025-08-24 09:18:44 +10:00
parent f00ea33a1b
commit 150754a7e1
+6 -4
View File
@@ -1459,8 +1459,9 @@ impl ChatWidget<'_> {
self.app_event_tx.send(AppEvent::RequestRedraw);
}
InputResult::ScrollUp => {
// If already at the very top, try navigating command history instead
if self.scroll_offset >= self.last_max_scroll.get() {
// Only allow Up to navigate command history when the top view
// cannot be scrolled at all (no scrollback available).
if self.last_max_scroll.get() == 0 {
if self.bottom_pane.try_history_up() { return; }
}
// Scroll up in chat history (increase offset, towards older content)
@@ -1486,8 +1487,9 @@ impl ChatWidget<'_> {
.record_event(HeightEvent::UserScroll);
}
InputResult::ScrollDown => {
// If browsing command history, give Down precedence to step forward
if self.bottom_pane.history_is_browsing() {
// Only allow Down to navigate command history when the top view
// cannot be scrolled at all (no scrollback available).
if self.last_max_scroll.get() == 0 && self.bottom_pane.history_is_browsing() {
if self.bottom_pane.try_history_down() { return; }
}
// Scroll down in chat history (decrease offset, towards bottom)