-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem
Input field cursor navigation is limited to single-character movement with arrow keys. Home/End keys work but are not discoverable, and there is no word-level navigation.
Proposed solution
Add standard terminal cursor shortcuts in handle_insert_key() (crates/zeph-tui/src/app.rs):
| Shortcut | Action |
|---|---|
| Alt+Left | Jump to previous word boundary |
| Alt+Right | Jump to next word boundary |
| Ctrl+A | Jump to start of line (same as Home) |
| Ctrl+E | Jump to end of line (same as End) |
| Alt+Backspace | Delete previous word |
Implementation
-
Add
prev_word_boundary(&self) -> usizeandnext_word_boundary(&self) -> usizehelpers that scanself.inputchars fromcursor_positionlooking for word boundaries (transition between whitespace/punctuation and alphanumeric). -
Handle
KeyCode::LeftwithALTmodifier andKeyCode::RightwithALTmodifier in the existing match block. -
Map
Ctrl+A/Ctrl+Eto cursor_position = 0 / char_count() respectively. -
Add
Alt+Backspaceto delete from cursor to previous word boundary. -
Add tests for all new navigation and deletion shortcuts.
Notes
- On macOS, Cmd+Arrow keys are intercepted by the terminal emulator and do not reach the application, so Ctrl+A/E (emacs-style) is the standard approach.
- Word boundary detection should handle Unicode properly (use
char::is_alphanumeric()). - Existing
Home/Endhandlers remain unchanged.