1
0
Fork 0
mirror of https://github.com/icewind1991/zox synced 2026-06-03 18:34:07 +02:00

fix case handling

This commit is contained in:
Robin Appelman 2021-02-24 16:07:50 +01:00
commit 98af2f1f1e

View file

@ -46,7 +46,6 @@ impl Args {
.finish()
.into_iter()
.filter_map(|s| s.into_string().ok())
.map(|s| s.to_ascii_lowercase())
.collect(),
}
}
@ -67,7 +66,8 @@ impl History {
}
pub fn matches(&self, pattern: &[String]) -> bool {
let mut remaining = self.path.as_str();
let path = self.path.to_ascii_lowercase();
let mut remaining = path.as_str();
for pat in pattern {
match remaining.find(pat) {
@ -214,7 +214,12 @@ fn main() -> Result<(), MainError> {
}
if let Ok(history) = history_result {
let matches = history.filter(|item| item.matches(&args.filter));
let filter: Vec<_> = args
.filter
.iter()
.map(|filter| filter.to_ascii_lowercase())
.collect();
let matches = history.filter(|item| item.matches(&filter));
let mut matches: Vec<History> = matches.collect();
matches.sort_by(|a, b| {