Do not move past number of matches
commit2ac496f919aeef4733367caac06ed4c39975822b
authorKevin Sjöberg <mail@kevinsjoberg.com>
dateSun 6 Jun 2021, 10:06 (5 years ago)
parent5463a43
helix-term/src/ui/picker.rs+5−2
@@ -100,8 +100,11 @@ impl<T> Picker<T> {
100100 }
101101
102102 pub fn move_down(&mut self) {
103− // TODO: len - 1
104− if self.cursor < self.options.len() {
103+ if self.matches.is_empty() {
104+ return;
105+ }
106+
107+ if self.cursor < self.matches.len() - 1 {
105108 self.cursor += 1;
106109 }
107110 }