Loading system/gd/rust/linux/client/src/editor.rs +9 −14 Original line number Diff line number Diff line Loading @@ -56,23 +56,18 @@ impl Completer for BtHelper { ) -> Result<(usize, Vec<String>), ReadlineError> { let slice = &line[..pos]; let candidates = self.get_candidates(slice.to_string().clone()); let mut completions = candidates .iter() .map(|c| { if candidates.len() == 1 { // If only one candidate, Completer will replace the input by // the returned string. Return the complete string here to avoid // input being replaced by the suggested word. slice.to_string() + &c.suggest_word[c.matched_len..] + " " } else { c.suggest_word.clone() } }) .collect::<Vec<String>>(); let mut completions = candidates.iter().map(|c| c.suggest_word.clone() + " ").collect::<Vec<String>>(); completions.sort(); Ok((0, completions)) // |start| points to the starting position of the current token let start = match slice.rfind(' ') { Some(x) => x + 1, None => 0, }; Ok((start, completions)) } } Loading Loading
system/gd/rust/linux/client/src/editor.rs +9 −14 Original line number Diff line number Diff line Loading @@ -56,23 +56,18 @@ impl Completer for BtHelper { ) -> Result<(usize, Vec<String>), ReadlineError> { let slice = &line[..pos]; let candidates = self.get_candidates(slice.to_string().clone()); let mut completions = candidates .iter() .map(|c| { if candidates.len() == 1 { // If only one candidate, Completer will replace the input by // the returned string. Return the complete string here to avoid // input being replaced by the suggested word. slice.to_string() + &c.suggest_word[c.matched_len..] + " " } else { c.suggest_word.clone() } }) .collect::<Vec<String>>(); let mut completions = candidates.iter().map(|c| c.suggest_word.clone() + " ").collect::<Vec<String>>(); completions.sort(); Ok((0, completions)) // |start| points to the starting position of the current token let start = match slice.rfind(' ') { Some(x) => x + 1, None => 0, }; Ok((start, completions)) } } Loading