From 2e1cec79dd60832e089ed4c67fe92f146b8efd9b Mon Sep 17 00:00:00 2001 From: heloanc <61081755+heloanc@users.noreply.github.com> Date: Sun, 10 May 2026 01:30:17 +0800 Subject: [PATCH] fix(tui): make Home/End keys move cursor in input box (#1246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, Home/End without modifiers scrolled the transcript instead of moving the cursor to the start/end of the input line. This is unexpected for most users who expect standard text editing behavior. Now: - Home/End (no modifier) → move cursor to start/end of input - Ctrl+Home/End → scroll transcript to top/bottom Closes #1234 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-authored-by: heloanc Co-authored-by: Claude Co-authored-by: Happy --- crates/tui/src/tui/keybindings.rs | 7 ++++++- crates/tui/src/tui/ui.rs | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/tui/src/tui/keybindings.rs b/crates/tui/src/tui/keybindings.rs index b38de8b6..10f0ad7b 100644 --- a/crates/tui/src/tui/keybindings.rs +++ b/crates/tui/src/tui/keybindings.rs @@ -99,7 +99,7 @@ pub const KEYBINDINGS: &[KeybindingEntry] = &[ section: KeybindingSection::Navigation, }, KeybindingEntry { - chord: "Home / End", + chord: "Ctrl+Home / Ctrl+End", description_id: crate::localization::MessageId::KbJumpTopBottom, section: KeybindingSection::Navigation, }, @@ -119,6 +119,11 @@ pub const KEYBINDINGS: &[KeybindingEntry] = &[ description_id: crate::localization::MessageId::KbMoveCursor, section: KeybindingSection::Editing, }, + KeybindingEntry { + chord: "Home / End", + description_id: crate::localization::MessageId::KbJumpLineStartEnd, + section: KeybindingSection::Editing, + }, KeybindingEntry { chord: "Ctrl+A / Ctrl+E", description_id: crate::localization::MessageId::KbJumpLineStartEnd, diff --git a/crates/tui/src/tui/ui.rs b/crates/tui/src/tui/ui.rs index 9993864c..6ae90877 100644 --- a/crates/tui/src/tui/ui.rs +++ b/crates/tui/src/tui/ui.rs @@ -2705,14 +2705,14 @@ async fn run_event_loop( KeyCode::Right => { app.move_cursor_right(); } - KeyCode::Home if key.modifiers.is_empty() => { + KeyCode::Home if key.modifiers.contains(KeyModifiers::CONTROL) => { if let Some(anchor) = TranscriptScroll::anchor_for(app.viewport.transcript_cache.line_meta(), 0) { app.viewport.transcript_scroll = anchor; } } - KeyCode::End if key.modifiers.is_empty() => { + KeyCode::End if key.modifiers.contains(KeyModifiers::CONTROL) => { app.scroll_to_bottom(); } KeyCode::Home | KeyCode::Char('a') @@ -2720,6 +2720,9 @@ async fn run_event_loop( { app.move_cursor_start(); } + KeyCode::Home => { + app.move_cursor_start(); + } KeyCode::End => { app.move_cursor_end(); }