diff options
author | Blaž Hrastnik | 2021-04-05 09:23:37 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-04-05 09:23:37 +0000 |
commit | 95d0bba81ae8ed035399b2cb362d2f65481d4781 (patch) | |
tree | af8d35e7de2864abec5d4188bdb7a29fb2ef56c2 /helix-term/src/ui/menu.rs | |
parent | 59a0fc7b59186b3bedb01dd5b958d3b97b9fbba2 (diff) |
ui: Improve completion state handling.
Diffstat (limited to 'helix-term/src/ui/menu.rs')
-rw-r--r-- | helix-term/src/ui/menu.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index fbd25a6d..30ac044c 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -123,11 +123,19 @@ impl<T> Menu<T> { .map(|(index, _score)| &self.options[*index]) }) } + + pub fn is_empty(&self) -> bool { + self.matches.is_empty() + } + + pub fn len(&self) -> usize { + self.matches.len() + } } use super::PromptEvent as MenuEvent; -impl<T> Component for Menu<T> { +impl<T: 'static> Component for Menu<T> { fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult { let event = match event { Event::Key(event) => event, |