diff options
author | Blaž Hrastnik | 2021-10-17 04:51:56 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-10-17 04:51:56 +0000 |
commit | 0a6b60085a56876068bf652c9491c435e9cca229 (patch) | |
tree | 8681db55d1a7707421f98d81a108d6438459536a /helix-term/src/ui/menu.rs | |
parent | bc0084d071ac53fa460370667cdd8740e7499c76 (diff) | |
parent | e216e9621e73cda1968632cd20595231af5e07be (diff) |
Merge branch 'master' into debug
Diffstat (limited to 'helix-term/src/ui/menu.rs')
-rw-r--r-- | helix-term/src/ui/menu.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index dab0c34f..055593fd 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -90,6 +90,14 @@ impl<T: Item> Menu<T> { self.recalculate = true; } + pub fn clear(&mut self) { + self.matches.clear(); + + // reset cursor position + self.cursor = None; + self.scroll = 0; + } + pub fn move_up(&mut self) { let len = self.matches.len(); let pos = self.cursor.map_or(0, |i| (i + len.saturating_sub(1)) % len) % len; |