|
|
@ -90,13 +90,13 @@ impl<T: Item> Menu<T> {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn move_up(&mut self) {
|
|
|
|
pub fn move_up(&mut self) {
|
|
|
|
// TODO: wrap around to end
|
|
|
|
// TODO: wrap around to end
|
|
|
|
let pos = self.cursor.map_or(0, |i| i.saturating_sub(1)) % self.options.len();
|
|
|
|
let pos = self.cursor.map_or(0, |i| i.saturating_sub(1)) % self.matches.len();
|
|
|
|
self.cursor = Some(pos);
|
|
|
|
self.cursor = Some(pos);
|
|
|
|
self.adjust_scroll();
|
|
|
|
self.adjust_scroll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn move_down(&mut self) {
|
|
|
|
pub fn move_down(&mut self) {
|
|
|
|
let pos = self.cursor.map_or(0, |i| i + 1) % self.options.len();
|
|
|
|
let pos = self.cursor.map_or(0, |i| i + 1) % self.matches.len();
|
|
|
|
self.cursor = Some(pos);
|
|
|
|
self.cursor = Some(pos);
|
|
|
|
self.adjust_scroll();
|
|
|
|
self.adjust_scroll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|