fix(scroll): Up/Down arrows now scroll transcript when composer is empty
The should_scroll_with_arrows gate was hardcoded to false since the initial commit, which meant bare Up/Down arrows always navigated composer history — they never scrolled the transcript view. Users in virtual terminals (Ghostty, Codex, Kitty-protocol terminals) were especially affected because they couldn't use the specialized Cmd+Up / Alt+Up shortcuts. The gate now returns true when the composer input is empty (or whitespace-only), so bare arrows scroll the transcript. When text is present, arrows still navigate composer history to recall previous prompts. Added 3 tests covering empty, whitespace-only, and text-filled composer states.
This commit is contained in:
@@ -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<String> {
|
||||
|
||||
@@ -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"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user