aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/menu.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui/menu.rs')
-rw-r--r--helix-term/src/ui/menu.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs
index f77f5e80..b60e6454 100644
--- a/helix-term/src/ui/menu.rs
+++ b/helix-term/src/ui/menu.rs
@@ -74,6 +74,7 @@ impl<T: Item> Menu<T> {
// rendering)
pub fn new(
options: Vec<T>,
+ sort: bool,
editor_data: <T as Item>::Data,
callback_fn: impl Fn(&mut Editor, Option<&T>, MenuEvent) + 'static,
) -> Self {
@@ -91,8 +92,12 @@ impl<T: Item> Menu<T> {
recalculate: true,
};
- // TODO: scoring on empty input should just use a fastpath
- menu.score("");
+ if sort {
+ // TODO: scoring on empty input should just use a fastpath
+ menu.score("");
+ } else {
+ menu.matches = (0..menu.options.len()).map(|i| (i, 0)).collect();
+ }
menu
}