diff options
author | Jan Hrastnik | 2020-11-02 09:41:27 +0000 |
---|---|---|
committer | Jan Hrastnik | 2020-11-02 09:41:27 +0000 |
commit | c9e9fcf7c549fe98f5ac5f13cdee213da9c9ad7a (patch) | |
tree | 0a95f4bcf134636d46d166ecfad891ab37d9da91 /helix-view/src/prompt.rs | |
parent | 28a1e11fda09414bc1d9f39994c170a20cfd1b12 (diff) |
added base col width
Diffstat (limited to 'helix-view/src/prompt.rs')
-rw-r--r-- | helix-view/src/prompt.rs | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/helix-view/src/prompt.rs b/helix-view/src/prompt.rs index beb5e76d..749e54d2 100644 --- a/helix-view/src/prompt.rs +++ b/helix-view/src/prompt.rs @@ -39,7 +39,7 @@ impl Prompt { } pub fn move_char_left(&mut self) { - if self.cursor > 1 { + if self.cursor > 0 { self.cursor -= 1; } } @@ -68,23 +68,25 @@ impl Prompt { } pub fn change_completion_selection(&mut self) { - self.completion_selection_index = self - .completion_selection_index - .map(|i| { - if i == self.completion.as_ref().unwrap().len() - 1 { - 0 - } else { - i + 1 - } - }) - .or(Some(0)); - self.line = String::from( - self.completion - .as_ref() - .unwrap() - .get(self.completion_selection_index.unwrap()) - .unwrap(), - ); + if self.completion.is_some() { + self.completion_selection_index = self + .completion_selection_index + .map(|i| { + if i == self.completion.as_ref().unwrap().len() - 1 { + 0 + } else { + i + 1 + } + }) + .or(Some(0)); + self.line = String::from( + self.completion + .as_ref() + .unwrap() + .get(self.completion_selection_index.unwrap()) + .unwrap(), + ); + } } pub fn exit_selection(&mut self) { |