From 95d0bba81ae8ed035399b2cb362d2f65481d4781 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Mon, 5 Apr 2021 18:23:37 +0900 Subject: ui: Improve completion state handling. --- helix-term/src/commands.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'helix-term/src/commands.rs') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 97078794..c3afbd92 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1691,8 +1691,12 @@ pub fn completion(cx: &mut Context) { // TODO: if no completion, show some message or something if !items.is_empty() { - let completion = Completion::new(items, trigger_offset); - compositor.push(Box::new(completion)); + use crate::compositor::AnyComponent; + let size = compositor.size(); + let ui = compositor.find("hx::ui::editor::EditorView").unwrap(); + if let Some(ui) = ui.as_any_mut().downcast_mut::() { + ui.set_completion(items, trigger_offset, size); + }; } }, ); -- cgit v1.2.3-70-g09d2