@@ -270,17 +270,15 @@ impl<T> Picker<T> {
272 pub fn move_up(&mut self) {
272 pub fn move_up(&mut self) {
273+ let len = self.matches.len();
273− self.cursor = self.cursor.saturating_sub(1);
274+ let pos = ((self.cursor + len.saturating_sub(1)) % len) % len;
276 pub fn move_down(&mut self) {
278 pub fn move_down(&mut self) {
277− if self.matches.is_empty() {
279+ let len = self.matches.len();
278− return;
280+ let pos = (self.cursor + 1) % len;
281− if self.cursor < self.matches.len() - 1 {
282− self.cursor += 1;
281+ self.cursor = pos;
286 pub fn selection(&self) -> Option<&T> {
284 pub fn selection(&self) -> Option<&T> {