summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui/editor.rs')
-rw-r--r--helix-term/src/ui/editor.rs26
1 files changed, 18 insertions, 8 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index d4b141a0..fd8e8fb2 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -952,7 +952,7 @@ impl EditorView {
start_offset: usize,
trigger_offset: usize,
size: Rect,
- ) {
+ ) -> Option<Rect> {
let mut completion = Completion::new(
editor,
savepoint,
@@ -964,15 +964,17 @@ impl EditorView {
if completion.is_empty() {
// skip if we got no completion results
- return;
+ return None;
}
+ let area = completion.area(size, editor);
editor.last_completion = None;
self.last_insert.1.push(InsertEvent::TriggerCompletion);
// TODO : propagate required size on resize to completion too
completion.required_size((size.width, size.height));
self.completion = Some(completion);
+ Some(area)
}
pub fn clear_completion(&mut self, editor: &mut Editor) {
@@ -1256,13 +1258,15 @@ impl Component for EditorView {
// let completion swallow the event if necessary
let mut consumed = false;
if let Some(completion) = &mut self.completion {
- // use a fake context here
- let mut cx = Context {
- editor: cx.editor,
- jobs: cx.jobs,
- scroll: None,
+ let res = {
+ // use a fake context here
+ let mut cx = Context {
+ editor: cx.editor,
+ jobs: cx.jobs,
+ scroll: None,
+ };
+ completion.handle_event(event, &mut cx)
};
- let res = completion.handle_event(event, &mut cx);
if let EventResult::Consumed(callback) = res {
consumed = true;
@@ -1270,6 +1274,12 @@ impl Component for EditorView {
if callback.is_some() {
// assume close_fn
self.clear_completion(cx.editor);
+
+ // In case the popup was deleted because of an intersection w/ the auto-complete menu.
+ commands::signature_help_impl(
+ &mut cx,
+ commands::SignatureHelpInvoked::Automatic,
+ );
}
}
}