diff --git a/CHANGELOG.md b/CHANGELOG.md index 1341680..5cb1337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ All notable changes to this project will be documented in this file. - Realtime thread scheduling (`SCHED_FIFO`) for sequencer thread on Unix systems, improving timing reliability. - Deep into the Linux hellscape: trying to get reliable performance, better stability, etc. +### Fixed +- Editor completion popup no longer steals arrow keys. Arrow keys always move the cursor; use Ctrl+N/Ctrl+P to navigate the completion list. + ## [0.0.4] - 2026-02-02 ### Added diff --git a/crates/ratatui/src/editor.rs b/crates/ratatui/src/editor.rs index d11d1c5..acd2bae 100644 --- a/crates/ratatui/src/editor.rs +++ b/crates/ratatui/src/editor.rs @@ -145,6 +145,18 @@ impl Editor { self.completion.active = false; } + pub fn completion_next(&mut self) { + if self.completion.cursor + 1 < self.completion.matches.len() { + self.completion.cursor += 1; + } + } + + pub fn completion_prev(&mut self) { + if self.completion.cursor > 0 { + self.completion.cursor -= 1; + } + } + pub fn set_completion_enabled(&mut self, enabled: bool) { self.completion.enabled = enabled; if !enabled { @@ -214,18 +226,6 @@ impl Editor { if self.completion.active && !has_modifier { match &input { - tui_textarea::Input { key: tui_textarea::Key::Up, .. } => { - if self.completion.cursor > 0 { - self.completion.cursor -= 1; - } - return; - } - tui_textarea::Input { key: tui_textarea::Key::Down, .. } => { - if self.completion.cursor + 1 < self.completion.matches.len() { - self.completion.cursor += 1; - } - return; - } tui_textarea::Input { key: tui_textarea::Key::Tab, .. } => { self.accept_completion(); return; diff --git a/src/input.rs b/src/input.rs index e4e00ec..d2aff3a 100644 --- a/src/input.rs +++ b/src/input.rs @@ -501,10 +501,18 @@ fn handle_modal_input(ctx: &mut InputContext, key: KeyEvent) -> InputResult { editor.activate_search(); } KeyCode::Char('n') if ctrl => { - editor.search_next(); + if editor.completion_active() { + editor.completion_next(); + } else { + editor.search_next(); + } } KeyCode::Char('p') if ctrl => { - editor.search_prev(); + if editor.completion_active() { + editor.completion_prev(); + } else { + editor.search_prev(); + } } KeyCode::Char('s') if ctrl => { ctx.dispatch(AppCommand::ToggleEditorStack);