aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-10-07 01:37:35 +0000
committerBlaž Hrastnik2021-10-07 01:37:35 +0000
commitf692ede2b7af9ee3c0a83642c0e169ac2db90ca5 (patch)
tree03e96c914fd6e1593c4b72036048a00b2b464fd1 /helix-term/src/ui
parent8ca91891d1f8f6df8073a4cc4af4132f8c6695ce (diff)
fix: Don't crash on empty completion, don't retrigger on close
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index fda6a6d3..9234bb96 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -730,6 +730,12 @@ impl EditorView {
) {
let mut completion =
Completion::new(editor, items, offset_encoding, start_offset, trigger_offset);
+
+ if completion.is_empty() {
+ // skip if we got no completion results
+ return;
+ }
+
// TODO : propagate required size on resize to completion too
completion.required_size((size.width, size.height));
self.completion = Some(completion);
@@ -939,6 +945,7 @@ impl Component for EditorView {
if callback.is_some() {
// assume close_fn
self.completion = None;
+ cxt.editor.clear_idle_timer(); // don't retrigger
}
}
}
@@ -952,6 +959,7 @@ impl Component for EditorView {
completion.update(&mut cxt);
if completion.is_empty() {
self.completion = None;
+ cxt.editor.clear_idle_timer(); // don't retrigger
}
}
}