mirror of
https://github.com/icewind1991/zox
synced 2026-06-03 18:34:07 +02:00
fix case handling
This commit is contained in:
parent
60d399015f
commit
98af2f1f1e
1 changed files with 8 additions and 3 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -46,7 +46,6 @@ impl Args {
|
||||||
.finish()
|
.finish()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|s| s.into_string().ok())
|
.filter_map(|s| s.into_string().ok())
|
||||||
.map(|s| s.to_ascii_lowercase())
|
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +66,8 @@ impl History {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn matches(&self, pattern: &[String]) -> bool {
|
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 {
|
for pat in pattern {
|
||||||
match remaining.find(pat) {
|
match remaining.find(pat) {
|
||||||
|
|
@ -214,7 +214,12 @@ fn main() -> Result<(), MainError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(history) = history_result {
|
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();
|
let mut matches: Vec<History> = matches.collect();
|
||||||
matches.sort_by(|a, b| {
|
matches.sort_by(|a, b| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue