diff --git a/crates/tui/src/tui/ui.rs b/crates/tui/src/tui/ui.rs index 73daacb0..3a49f1a5 100644 --- a/crates/tui/src/tui/ui.rs +++ b/crates/tui/src/tui/ui.rs @@ -7378,8 +7378,12 @@ fn is_ctrl_h_backspace(key: &KeyEvent) -> bool { && !key.modifiers.contains(KeyModifiers::SUPER) } -fn should_scroll_with_arrows(_app: &App) -> bool { - false +fn should_scroll_with_arrows(app: &App) -> bool { + // When the composer is empty (or only whitespace), Up/Down arrows + // scroll the transcript. When the composer has text, they navigate + // composer history so the user can recall previous prompts. + // Cmd+Up / Alt+Up always scroll regardless, handled upstream. + app.input.trim().is_empty() } fn extract_reasoning_header(text: &str) -> Option { diff --git a/crates/tui/src/tui/ui/tests.rs b/crates/tui/src/tui/ui/tests.rs index d44bcb64..5bbe9c0c 100644 --- a/crates/tui/src/tui/ui/tests.rs +++ b/crates/tui/src/tui/ui/tests.rs @@ -3134,3 +3134,34 @@ fn checklist_write_renders_dedicated_card() { "raw JSON must NOT appear: {joined}" ); } + +// ---- scroll_with_arrows ---- + +#[test] +fn scroll_with_arrows_returns_true_when_input_empty() { + let app = create_test_app(); + assert!( + super::should_scroll_with_arrows(&app), + "empty composer: Up/Down should scroll transcript" + ); +} + +#[test] +fn scroll_with_arrows_returns_true_when_input_only_whitespace() { + let mut app = create_test_app(); + app.input = " ".to_string(); + assert!( + super::should_scroll_with_arrows(&app), + "whitespace-only composer: Up/Down should scroll transcript" + ); +} + +#[test] +fn scroll_with_arrows_returns_false_when_input_has_text() { + let mut app = create_test_app(); + app.input = "hello".to_string(); + assert!( + !super::should_scroll_with_arrows(&app), + "text in composer: Up/Down should navigate history" + ); +}