diff --git a/src/components/completion.rs b/src/components/completion.rs index c8b785c..2388c0e 100644 --- a/src/components/completion.rs +++ b/src/components/completion.rs @@ -73,20 +73,15 @@ impl CompletionComponent { }) } - pub fn string_to_be_completed(&self) -> Option { - let len = self.word.len(); - Some(format!( - "{} ", - self.filterd_candidates() - .collect::>() - .get(self.state.selected()?) - .map(|c| c.to_string())? - .chars() - .enumerate() - .filter(|(i, _)| i >= &len) - .map(|(_, c)| c) - .collect::() - )) + pub fn selected_candidate(&self) -> Option { + self.filterd_candidates() + .collect::>() + .get(self.state.selected()?) + .map(|c| c.to_string()) + } + + pub fn word(&self) -> String { + self.word.to_string() } }