mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-01 04:30:49 +12:00
In history window support searching tags
This commit is contained in:
parent
5500e4d553
commit
e1ee32f7cd
|
@ -39,6 +39,7 @@ public partial class HistoryForm : Form
|
||||||
{
|
{
|
||||||
public string HistoryPath { get; private set; }
|
public string HistoryPath { get; private set; }
|
||||||
public HistorySettings Settings { get; private set; }
|
public HistorySettings Settings { get; private set; }
|
||||||
|
public bool SearchInTags { get; set; } = true;
|
||||||
|
|
||||||
private HistoryManager history;
|
private HistoryManager history;
|
||||||
private HistoryItemManager him;
|
private HistoryItemManager him;
|
||||||
|
@ -213,8 +214,9 @@ private HistoryItem[] ApplyFilters(HistoryItem[] historyItems)
|
||||||
if (!string.IsNullOrEmpty(filenameFilter))
|
if (!string.IsNullOrEmpty(filenameFilter))
|
||||||
{
|
{
|
||||||
string pattern = Regex.Escape(filenameFilter).Replace("\\?", ".").Replace("\\*", ".*");
|
string pattern = Regex.Escape(filenameFilter).Replace("\\?", ".").Replace("\\*", ".*");
|
||||||
Regex regex = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
Regex regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
result = result.Where(x => x.FileName != null && regex.IsMatch(x.FileName));
|
result = result.Where(x => (x.FileName != null && regex.IsMatch(x.FileName)) ||
|
||||||
|
(SearchInTags && x.Tags != null && x.Tags.Any(tag => regex.IsMatch(tag.Value))));
|
||||||
}
|
}
|
||||||
|
|
||||||
string urlFilter = txtURLFilter.Text;
|
string urlFilter = txtURLFilter.Text;
|
||||||
|
|
Loading…
Reference in a new issue