Skip to content

Commit 6bfcd65

Browse files
committed
Highlighting Quick Filter text with red background Closing #206
1 parent ca52b8c commit 6bfcd65

File tree

6 files changed

+120
-110
lines changed

6 files changed

+120
-110
lines changed

PluginTraceViewer/Controls/ExceptionControl.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Linq;
1+
using System.Drawing;
2+
using System.Linq;
23
using System.Threading.Tasks;
34
using System.Windows.Forms;
45
using WeifenLuo.WinFormsUI.Docking;
@@ -18,7 +19,7 @@ public ExceptionControl(PluginTraceViewer ptv)
1819
InitializeComponent();
1920
}
2021

21-
internal void SetException(string log, string caption)
22+
internal void SetException(string log, string caption, string quickfilter)
2223
{
2324
textException.Clear();
2425
TabText = caption;
@@ -41,10 +42,10 @@ internal void SetException(string log, string caption)
4142
DockState;
4243
}
4344
originallog = log.Replace("\r\n", "\n");
44-
_ = ShowMessageTextAsync(ptv.tsmiHighlightGuids.Checked, ptv.tsmiIdentifyRecords.Checked);
45+
_ = ShowMessageTextAsync(ptv.tsmiHighlightGuids.Checked, ptv.tsmiIdentifyRecords.Checked, quickfilter);
4546
}
4647

47-
internal async Task ShowMessageTextAsync(bool highlightguids, bool showlinks)
48+
internal async Task ShowMessageTextAsync(bool highlightguids, bool showlinks, string quickfilter)
4849
{
4950
btnShowAllRecordLinks.Visible = showlinks;
5051
btnShowAllRecordLinks.Enabled = false;
@@ -71,6 +72,17 @@ internal async Task ShowMessageTextAsync(bool highlightguids, bool showlinks)
7172
}
7273
links.HighlightRecords(textException);
7374
}
75+
if (!string.IsNullOrWhiteSpace(quickfilter))
76+
{
77+
var length = quickfilter.Length;
78+
var pos = textException.Find(quickfilter, 0, RichTextBoxFinds.None);
79+
while (pos != -1)
80+
{
81+
textException.SelectionBackColor = Color.Red;
82+
textException.SelectionColor = Color.White;
83+
pos = textException.Find(quickfilter, pos + length, RichTextBoxFinds.None);
84+
}
85+
}
7486
textException.Select(0, 0);
7587
}
7688

PluginTraceViewer/Controls/GridControl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ private static List<ExecuteMultipleRequest> Bundle(IEnumerable<Entity> entities)
618618
private void txtQuickFilter_TextChanged(object sender, EventArgs e)
619619
{
620620
crmGridView.FilterText = txtQuickFilter.Text;
621+
ptv.UpdateHighlighting();
621622
}
622623
}
623624
}

0 commit comments

Comments
 (0)