feat: dynamic prefix fallback for user plugin prefixes (e.g. :hs for hyprshutdown)
This commit is contained in:
@@ -360,6 +360,28 @@ impl ProviderFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dynamic plugin prefix fallback: ":word " or ":word" where word is unknown
|
||||||
|
// Maps to Plugin(word) so user plugins with custom prefixes work
|
||||||
|
if let Some(rest) = trimmed.strip_prefix(':') {
|
||||||
|
if let Some(space_idx) = rest.find(' ') {
|
||||||
|
let prefix_word = &rest[..space_idx];
|
||||||
|
if !prefix_word.is_empty() && prefix_word.chars().all(|c| c.is_alphanumeric() || c == '-' || c == '_') {
|
||||||
|
return ParsedQuery {
|
||||||
|
prefix: Some(ProviderType::Plugin(prefix_word.to_string())),
|
||||||
|
tag_filter: None,
|
||||||
|
query: rest[space_idx + 1..].to_string(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else if !rest.is_empty() && rest.chars().all(|c| c.is_alphanumeric() || c == '-' || c == '_') {
|
||||||
|
// Partial prefix (no space yet)
|
||||||
|
return ParsedQuery {
|
||||||
|
prefix: Some(ProviderType::Plugin(rest.to_string())),
|
||||||
|
tag_filter: None,
|
||||||
|
query: String::new(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let result = ParsedQuery {
|
let result = ParsedQuery {
|
||||||
prefix: None,
|
prefix: None,
|
||||||
tag_filter: None,
|
tag_filter: None,
|
||||||
|
|||||||
Reference in New Issue
Block a user