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 Jul 7, 2022
1 parent 1c0da34 commit df7ff54
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 @@ -1031,19 +1031,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 df7ff54

Please sign in to comment.