mirror of
https://github.com/lin-ycv/EverythingPowerToys.git
synced 2025-01-08 11:57:59 +08:00
Fixed Multi-filter issues (#77)
* 解决文件过滤和自带过滤不能同时使用的问题 * Removed redundant step in parsing filters from settings --------- Co-authored-by: Lin Yu-Chieh (Victor) <victorlin@gapps.ntust.edu.tw>
This commit is contained in:
parent
ef0a3e5a5e
commit
220c027f7d
@ -41,9 +41,20 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
|
||||
if (orgqry.Contains(':'))
|
||||
{
|
||||
string[] nqry = query.Split(':', 2);
|
||||
if (setting.Filters.TryGetValue(nqry[0].ToLowerInvariant(), out string value))
|
||||
query = nqry[1].Trim() + " ext:" + value;
|
||||
fStringBuilder sb = new();
|
||||
foreach (var kv in setting.Filters)
|
||||
{
|
||||
if (query.Contains(kv.Key, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
sb.Append(kv.Value + ';');
|
||||
query = query.Replace(kv.Key, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
query = query.Trim() + " ext:" + sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
_ = Everything_SetSearchW(query);
|
||||
|
@ -35,7 +35,7 @@ namespace Community.PowerToys.Run.Plugin.Everything
|
||||
if (kv.Length != 2) continue;
|
||||
|
||||
if (kv[0].Contains(':'))
|
||||
Filters.TryAdd(kv[0].Split(':')[0].ToLowerInvariant(), kv[1]);
|
||||
Filters.TryAdd(kv[0].ToLowerInvariant(), kv[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user