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

@@ -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;