summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/picker.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-10-17 04:51:56 +0000
committerBlaž Hrastnik2021-10-17 04:51:56 +0000
commit0a6b60085a56876068bf652c9491c435e9cca229 (patch)
tree8681db55d1a7707421f98d81a108d6438459536a /helix-term/src/ui/picker.rs
parentbc0084d071ac53fa460370667cdd8740e7499c76 (diff)
parente216e9621e73cda1968632cd20595231af5e07be (diff)
Merge branch 'master' into debug
Diffstat (limited to 'helix-term/src/ui/picker.rs')
-rw-r--r--helix-term/src/ui/picker.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index ee1ec177..341235ee 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -271,12 +271,18 @@ impl<T> Picker<T> {
}
pub fn move_up(&mut self) {
+ if self.matches.is_empty() {
+ return;
+ }
let len = self.matches.len();
let pos = ((self.cursor + len.saturating_sub(1)) % len) % len;
self.cursor = pos;
}
pub fn move_down(&mut self) {
+ if self.matches.is_empty() {
+ return;
+ }
let len = self.matches.len();
let pos = (self.cursor + 1) % len;
self.cursor = pos;