Skip to content

Commit

Permalink
Simplify EditorView::set_or_extend_completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp-M committed Jun 29, 2022
1 parent bd808ff commit b685db7
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,19 +1024,16 @@ impl EditorView {
trigger_offset: usize,
size: Rect,
) {
// cheap check, if the completion menu resulted of the same 'completion' trigger (e.g. by commands::completion)
// TODO test/check if this is enough/safe...
match &mut self.completion {
Some(completion) => {
// cheap check, if the completion menu resulted of the same 'completion' trigger (e.g. by commands::completion)
// TODO test/check if this is enough/safe...
Some(completion)
if start_offset == completion.start_offset()
&& completion.trigger_offset() == trigger_offset
{
completion.add_completion_items(items)
} else {
self.set_completion(editor, items, start_offset, trigger_offset, size)
}
&& completion.trigger_offset() == trigger_offset =>
{
completion.add_completion_items(items)
}
None => self.set_completion(editor, items, start_offset, trigger_offset, size),
_ => self.set_completion(editor, items, start_offset, trigger_offset, size),
}
}

Expand Down

0 comments on commit b685db7

Please sign in to comment.