summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorKevin Sjöberg2021-06-06 07:49:37 +0000
committerBlaž Hrastnik2021-06-06 12:48:19 +0000
commit3494bb8ef0e3c43e0507d264867c1e1e572c2367 (patch)
tree89bdf551cd7c97eee8fe36988dff8f92b792737e /helix-term/src
parenta4ff8cdd8a7f2fd39eb15ce6f591e4cea9868c39 (diff)
Refactor index assignment
Co-authored-by: Ivan Tham <pickfire@riseup.net>
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/prompt.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 95c42fbc..5b074d01 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -91,13 +91,11 @@ impl Prompt {
}
let index = match direction {
- CompletionDirection::Forward => {
- self.selection.map_or(0, |i| i + 1) % self.completion.len()
- }
+ CompletionDirection::Forward => self.selection.map_or(0, |i| i + 1),
CompletionDirection::Backward => {
- (self.selection.unwrap_or(0) + self.completion.len() - 1) % self.completion.len()
+ self.selection.unwrap_or(0) + self.completion.len() - 1
}
- };
+ } % self.completion.len();
self.selection = Some(index);