feat: multiple queries in filter separated by |
1 file changed, +6 -1
+6-1src/widgets/miller.rs
| @@ -203,11 +203,16 @@ impl MillerFilter { | ||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /// Fuzzy match a label against the query. Returns true if it matches (or query is empty). |
| 206 | + /// Supports `|` to OR multiple terms (e.g. "start|report" matches either). | |
| 206 | 207 | pub fn matches(&self, label: &str) -> bool { |
| 207 | 208 | if self.query.is_empty() { |
| 208 | 209 | return true; |
| 209 | 210 | } |
| 210 | - fuzzy_matches(&self.query, label) | |
| 211 | + self.query.split('|') | |
| 212 | + .any(|term| { | |
| 213 | + let term = term.trim(); | |
| 214 | + !term.is_empty() && fuzzy_matches(term, label) | |
| 215 | + }) | |
| 211 | 216 | } |
| 212 | 217 | |
| 213 | 218 | /// Filter a list of labels and manage selection mapping. |