aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/completion.rs2
-rw-r--r--helix-term/src/ui/menu.rs9
2 files changed, 8 insertions, 3 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs
index 7348dcf4..2e555e4b 100644
--- a/helix-term/src/ui/completion.rs
+++ b/helix-term/src/ui/completion.rs
@@ -97,7 +97,7 @@ impl Completion {
start_offset: usize,
trigger_offset: usize,
) -> Self {
- let menu = Menu::new(items, (), move |editor: &mut Editor, item, event| {
+ let menu = Menu::new(items, true, (), move |editor: &mut Editor, item, event| {
fn item_to_transaction(
doc: &Document,
item: &CompletionItem,
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
}