|
|
@ -469,6 +469,20 @@ impl<T: Item> Picker<T> {
|
|
|
|
|
|
|
|
|
|
|
|
self.matches.sort_unstable();
|
|
|
|
self.matches.sort_unstable();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
self.force_score();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log::debug!("picker score {:?}", Instant::now().duration_since(now));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// reset cursor position
|
|
|
|
|
|
|
|
self.cursor = 0;
|
|
|
|
|
|
|
|
let pattern = self.prompt.line();
|
|
|
|
|
|
|
|
self.previous_pattern.clone_from(pattern);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn force_score(&mut self) {
|
|
|
|
|
|
|
|
let pattern = self.prompt.line();
|
|
|
|
|
|
|
|
|
|
|
|
let query = FuzzyQuery::new(pattern);
|
|
|
|
let query = FuzzyQuery::new(pattern);
|
|
|
|
self.matches.clear();
|
|
|
|
self.matches.clear();
|
|
|
|
self.matches.extend(
|
|
|
|
self.matches.extend(
|
|
|
@ -490,13 +504,6 @@ impl<T: Item> Picker<T> {
|
|
|
|
self.matches.sort_unstable();
|
|
|
|
self.matches.sort_unstable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
log::debug!("picker score {:?}", Instant::now().duration_since(now));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// reset cursor position
|
|
|
|
|
|
|
|
self.cursor = 0;
|
|
|
|
|
|
|
|
self.previous_pattern.clone_from(pattern);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Move the cursor by a number of lines, either down (`Forward`) or up (`Backward`)
|
|
|
|
/// Move the cursor by a number of lines, either down (`Forward`) or up (`Backward`)
|
|
|
|
pub fn move_by(&mut self, amount: usize, direction: Direction) {
|
|
|
|
pub fn move_by(&mut self, amount: usize, direction: Direction) {
|
|
|
|
let len = self.matches.len();
|
|
|
|
let len = self.matches.len();
|
|
|
|