From c9e9fcf7c549fe98f5ac5f13cdee213da9c9ad7a Mon Sep 17 00:00:00 2001 From: Jan Hrastnik Date: Mon, 2 Nov 2020 10:41:27 +0100 Subject: added base col width --- helix-view/src/prompt.rs | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'helix-view/src/prompt.rs') 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) { -- cgit v1.2.3-70-g09d2