diff options
author | Blaž Hrastnik | 2021-07-23 09:12:33 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-07-23 09:12:33 +0000 |
commit | 1789dfabfe68c00dda3b861b828ea7a50860f6e7 (patch) | |
tree | eb8ef9eabaa34303227f7c527429452f49194a2e /helix-term/src | |
parent | e5d438705b3554c078adbe99cc64323967ff2406 (diff) |
fix: ui/menu: Don't allow scrolling past the end of completion
Fixes #472
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/ui/menu.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index dc3bbf7f..5a6f6256 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -90,13 +90,13 @@ impl<T: Item> Menu<T> { pub fn move_up(&mut self) { // TODO: wrap around to end - let pos = self.cursor.map_or(0, |i| i.saturating_sub(1)) % self.options.len(); + let pos = self.cursor.map_or(0, |i| i.saturating_sub(1)) % self.matches.len(); self.cursor = Some(pos); self.adjust_scroll(); } pub fn move_down(&mut self) { - let pos = self.cursor.map_or(0, |i| i + 1) % self.options.len(); + let pos = self.cursor.map_or(0, |i| i + 1) % self.matches.len(); self.cursor = Some(pos); self.adjust_scroll(); } |