Some more autocomplete improvs
This commit is contained in:
@ -94,12 +94,12 @@ impl Search {
|
||||
SearchType::CmdSearch => autocomplete_cmd(&self.searchee, &self),
|
||||
SearchType::FileSearch => match autocomplete_file(&self) {
|
||||
Ok(t) => t,
|
||||
Err(_) => (String::new(), String::new()),
|
||||
Err(_) => (format!("{}{}", &self.command, &self.searchee), String::new()),
|
||||
}
|
||||
};
|
||||
|
||||
if res.len() < 1 {
|
||||
*&mut res = format!("{} {}", &self.command, &self.searchee);
|
||||
*&mut res = format!("{}{}", &self.command, &self.searchee);
|
||||
}
|
||||
|
||||
return (res, res_lines);
|
||||
@ -185,7 +185,12 @@ fn autocomplete_file(search: &Search) -> std::io::Result<(String, String)> {
|
||||
//Handle returning the longest sequence of characters between two or more matching files
|
||||
if nbr_found > 1 {
|
||||
let longest = find_common_chars(results);
|
||||
*&mut last_found = longest;
|
||||
*&mut last_found = longest;
|
||||
}
|
||||
|
||||
if nbr_found == 0 {
|
||||
let ret_val = format!("{}{}", &search.command, &search.searchee);
|
||||
return Ok((ret_val, String::new()));
|
||||
}
|
||||
|
||||
//Handle the path when tabbing in a long path, zsh-like
|
||||
@ -214,7 +219,7 @@ fn autocomplete_cmd(input: &String, search: &Search) -> (String, String) {
|
||||
return (res_string, res_list);
|
||||
} else if found_bins.len() == 0 {
|
||||
let list = String::from("Nothing adequate.");
|
||||
let res = String::new();
|
||||
let res = String::from("");
|
||||
return (res, list);
|
||||
} else {
|
||||
let mut all_res = String::new();
|
||||
|
Reference in New Issue
Block a user