Completions
This commit is contained in:
parent
9fc30022ec
commit
a207a38101
1 changed files with 6 additions and 0 deletions
|
@ -86,6 +86,10 @@ impl Roftl {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn narrow(&mut self, input: &str) -> Vec<(&Entry, Vec<usize>)> {
|
pub fn narrow(&mut self, input: &str) -> Vec<(&Entry, Vec<usize>)> {
|
||||||
|
let mut completions = std::collections::HashMap::new();
|
||||||
|
completions.insert("e", "emacs");
|
||||||
|
completions.insert("f", "firefox");
|
||||||
|
|
||||||
let mut scored_entries: Vec<(f64, usize, &Entry, Vec<usize>)> = self.entries
|
let mut scored_entries: Vec<(f64, usize, &Entry, Vec<usize>)> = self.entries
|
||||||
.par_iter()
|
.par_iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
|
@ -94,6 +98,8 @@ impl Roftl {
|
||||||
|
|
||||||
if input.is_empty() { return Some((0.0, idx, entry, vec![])) }
|
if input.is_empty() { return Some((0.0, idx, entry, vec![])) }
|
||||||
|
|
||||||
|
let input = completions.get(input).unwrap_or(&input);
|
||||||
|
|
||||||
let match_result = self.primary_matcher.try_match(&entry.name, input);
|
let match_result = self.primary_matcher.try_match(&entry.name, input);
|
||||||
return match_result.map(|(score, indices)| (score, idx, entry, indices) )
|
return match_result.map(|(score, indices)| (score, idx, entry, indices) )
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue