Do not move past number of matches

This commit is contained in:
Kevin Sjöberg 2021-06-06 10:06:47 +02:00 committed by Blaž Hrastnik
parent 5463a436a8
commit 2ac496f919

View file

@ -100,8 +100,11 @@ impl<T> Picker<T> {
}
pub fn move_down(&mut self) {
// TODO: len - 1
if self.cursor < self.options.len() {
if self.matches.is_empty() {
return;
}
if self.cursor < self.matches.len() - 1 {
self.cursor += 1;
}
}