aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Sjöberg2021-06-06 08:06:47 +0000
committerBlaž Hrastnik2021-06-06 09:04:45 +0000
commit2ac496f919aeef4733367caac06ed4c39975822b (patch)
treeff6c1507fd35f376a0bd566f329cbb45b4ae4a13
parent5463a436a8d5647b90c7bfc54f7fc714465384fa (diff)
Do not move past number of matches
-rw-r--r--helix-term/src/ui/picker.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 4cff4917..c3592062 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -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;
}
}