Update tui/src/filter.rs

Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com>
This commit is contained in:
Jeevitha Kannan K S 2024-11-12 21:07:43 +05:30 committed by GitHub
parent 02b06129e1
commit df81642c9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,12 +93,9 @@ impl Filter {
} else { } else {
let input = self.search_input.iter().collect::<String>().to_lowercase(); let input = self.search_input.iter().collect::<String>().to_lowercase();
self.items.iter().find_map(|item| { self.items.iter().find_map(|item| {
let item_name_lower = &item.node.name.to_lowercase(); let item_name_lower = item.node.name.to_lowercase();
if item_name_lower.starts_with(&input) { (item_name_lower.starts_with(&input))
Some(item_name_lower[input.len()..].to_string()) .then_some(item_name_lower[input.len()..].to_string())
} else {
None
}
}) })
} }
} }