Fix: dict popup in editor is less intrusive

This commit is contained in:
2026-02-03 17:02:07 +01:00
parent 9b5759d794
commit 96489c8f72
3 changed files with 25 additions and 14 deletions

View File

@@ -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. - 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. - 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 ## [0.0.4] - 2026-02-02
### Added ### Added

View File

@@ -145,6 +145,18 @@ impl Editor {
self.completion.active = false; 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) { pub fn set_completion_enabled(&mut self, enabled: bool) {
self.completion.enabled = enabled; self.completion.enabled = enabled;
if !enabled { if !enabled {
@@ -214,18 +226,6 @@ impl Editor {
if self.completion.active && !has_modifier { if self.completion.active && !has_modifier {
match &input { 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, .. } => { tui_textarea::Input { key: tui_textarea::Key::Tab, .. } => {
self.accept_completion(); self.accept_completion();
return; return;

View File

@@ -501,10 +501,18 @@ fn handle_modal_input(ctx: &mut InputContext, key: KeyEvent) -> InputResult {
editor.activate_search(); editor.activate_search();
} }
KeyCode::Char('n') if ctrl => { KeyCode::Char('n') if ctrl => {
editor.search_next(); if editor.completion_active() {
editor.completion_next();
} else {
editor.search_next();
}
} }
KeyCode::Char('p') if ctrl => { KeyCode::Char('p') if ctrl => {
editor.search_prev(); if editor.completion_active() {
editor.completion_prev();
} else {
editor.search_prev();
}
} }
KeyCode::Char('s') if ctrl => { KeyCode::Char('s') if ctrl => {
ctx.dispatch(AppCommand::ToggleEditorStack); ctx.dispatch(AppCommand::ToggleEditorStack);