Autocomplete is now case insensitive

This commit is contained in:
Justine 2023-02-20 14:12:25 +01:00
parent 26182f3b4d
commit 40a61e7e68

View File

@ -149,7 +149,7 @@ fn autocomplete_file(search: &Search) -> std::io::Result<(String, String)> {
.unwrap()
.to_str()
.unwrap();
let re = format!("^{}.*$", search.searchee);
let re = format!("(?i)^{}.*$", search.searchee);
let regex = Regex::new(&re).unwrap();
if regex.is_match(filename) {
if search.local_search {
@ -250,7 +250,7 @@ fn autocomplete_cmd(input: &String, search: &Search) -> (String, String) {
///Takes a string and returns a Vector of PathBuf containing all matchings
///commands
fn find_bin(command: &String) -> Vec<PathBuf> {
let re = format!("^{}.*", command);
let re = format!("(?i)^{}.*", command);
let re = Regex::new(&re).unwrap();
let mut binaries: Vec<PathBuf> = which_re(re).unwrap().collect();
binaries.sort();