@@ -270,17 +270,15 @@ impl<T> Picker<T> {
270270 }
271271
272272 pub fn move_up(&mut self) {
273− self.cursor = self.cursor.saturating_sub(1);
273+ let len = self.matches.len();
274+ let pos = ((self.cursor + len.saturating_sub(1)) % len) % len;
275+ self.cursor = pos;
274276 }
275277
276278 pub fn move_down(&mut self) {
277− if self.matches.is_empty() {
278− return;
279− }
280−
281− if self.cursor < self.matches.len() - 1 {
282− self.cursor += 1;
283− }
279+ let len = self.matches.len();
280+ let pos = (self.cursor + 1) % len;
281+ self.cursor = pos;
284282 }
285283
286284 pub fn selection(&self) -> Option<&T> {