fix(tui): make Home/End keys move cursor in input box (#1246)
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 <heloanc@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user