aboutsummaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/command.rs b/src/command.rs
index 26aeb05..6e9f900 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -224,14 +224,14 @@ impl CommandBox {
224 self.invalidate_completions(); 224 self.invalidate_completions();
225 } 225 }
226 226
227 pub fn complete_next(&mut self, env_list: &[Environment]) { 227 pub fn complete(&mut self, env_list: &[Environment], reverse: bool) {
228 let c = self.cursor; 228 let c = self.cursor;
229 // completions exist, fill with next completion 229 // completions exist, fill with next completion
230 if let Some(cs) = &mut self.completions { 230 if let Some(cs) = &mut self.completions {
231 self.cursor = cs.trigger_idx; 231 self.cursor = cs.trigger_idx;
232 let prev_len = cs.get().len(); 232 let prev_len = cs.get().len();
233 // skips over the first empty completion 233 // skips over the first empty completion
234 let new_insertion = cs.next(); 234 let new_insertion = if reverse { cs.prev() } else { cs.next() };
235 self.text = format!( 235 self.text = format!(
236 "{}{}{}", 236 "{}{}{}",
237 &self.text[..self.cursor], 237 &self.text[..self.cursor],
@@ -249,7 +249,7 @@ impl CommandBox {
249 .map(|&s| s.to_owned()) 249 .map(|&s| s.to_owned())
250 .collect(), 250 .collect(),
251 )); 251 ));
252 self.complete_next(env_list) 252 self.complete(env_list, reverse)
253 } 253 }
254 } 254 }
255} 255}