Return input on autocomplete when no results
This commit is contained in:
@ -86,13 +86,18 @@ impl Search {
|
||||
///Performs the search and returns (most likely result, result lines to display)
|
||||
///A found file is preferred to a found command
|
||||
pub fn autocomplete(&self) -> (String, String) {
|
||||
let (res, res_lines) = match &self.search_type {
|
||||
let (mut res, res_lines) = match &self.search_type {
|
||||
SearchType::CmdSearch => autocomplete_cmd(&self.searchee),
|
||||
SearchType::FileSearch => match autocomplete_file(&self) {
|
||||
Ok(t) => t,
|
||||
Err(_) => (String::new(), String::new()),
|
||||
}
|
||||
};
|
||||
|
||||
if res.len() < 1 {
|
||||
*&mut res = format!("{} {}", &self.command, &self.searchee);
|
||||
}
|
||||
|
||||
return (res, res_lines);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user