From 0cc52ccf63e23e913624bbe1d42b319cc154c89d Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Tue, 24 Aug 2021 20:05:00 +0200 Subject: [PATCH] feat(modulo): sort search items --- espanso-modulo/src/search/generator.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/espanso-modulo/src/search/generator.rs b/espanso-modulo/src/search/generator.rs index cc55859..98a9c88 100644 --- a/espanso-modulo/src/search/generator.rs +++ b/espanso-modulo/src/search/generator.rs @@ -21,7 +21,7 @@ use crate::search::config::SearchConfig; use crate::sys::search::types; pub fn generate(config: SearchConfig) -> types::Search { - let items = config + let mut items: Vec = config .items .into_iter() .map(|item| types::SearchItem { @@ -32,6 +32,8 @@ pub fn generate(config: SearchConfig) -> types::Search { }) .collect(); + items.sort_by(|a, b| a.label.as_str().cmp(b.label.as_str())); + types::Search { title: config.title, items,