diff options
author | Kevin Sjöberg | 2021-06-06 08:06:47 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-06 09:04:45 +0000 |
commit | 2ac496f919aeef4733367caac06ed4c39975822b (patch) | |
tree | ff6c1507fd35f376a0bd566f329cbb45b4ae4a13 /helix-term/src/ui/picker.rs | |
parent | 5463a436a8d5647b90c7bfc54f7fc714465384fa (diff) |
Do not move past number of matches
Diffstat (limited to 'helix-term/src/ui/picker.rs')
-rw-r--r-- | helix-term/src/ui/picker.rs | 7 |
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; } } |