summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-term/src/ui/picker.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 5d88622c..3f2da92f 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -415,6 +415,11 @@ impl<T> Picker<T> {
pub fn move_by(&mut self, amount: usize, direction: Direction) {
let len = self.matches.len();
+ if len == 0 {
+ // No results, can't move.
+ return;
+ }
+
match direction {
Direction::Forward => {
self.cursor = self.cursor.saturating_add(amount) % len;