aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-14 05:12:54 +0000
committerBlaž Hrastnik2020-12-14 05:12:54 +0000
commited6a4c4bd240630355d1c61a1c05c4e22bf62a86 (patch)
tree6ecac67f9e7f3e0d5d15917a364057f7dd342db1 /helix-term/src/ui
parent07801b60bccd0f084eae925e0290c24322de575f (diff)
wip: Use prompt for interactive commands.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/prompt.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index ce00a129..d1d92975 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -10,7 +10,6 @@ pub struct Prompt {
pub line: String,
pub cursor: usize,
pub completion: Vec<String>,
- pub should_close: bool,
pub completion_selection_index: Option<usize>,
completion_fn: Box<dyn FnMut(&str) -> Vec<String>>,
callback_fn: Box<dyn FnMut(&mut Editor, &str)>,
@@ -27,7 +26,6 @@ impl Prompt {
line: String::new(),
cursor: 0,
completion: completion_fn(""),
- should_close: false,
completion_selection_index: None,
completion_fn: Box::new(completion_fn),
callback_fn: Box::new(callback_fn),
@@ -42,9 +40,7 @@ impl Prompt {
}
pub fn move_char_left(&mut self) {
- if self.cursor > 0 {
- self.cursor -= 1;
- }
+ self.cursor = self.cursor.saturating_sub(1)
}
pub fn move_char_right(&mut self) {