From 91f90befb3712a77d519a687310218628e8cf007 Mon Sep 17 00:00:00 2001 From: yumaojun Date: Thu, 2 Mar 2023 17:50:08 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=EF=BC=9A=E6=AD=A3=E5=88=99=E8=A1=A8?= =?UTF-8?q?=E8=BE=BE=E5=BC=8F=E5=AD=97=E7=AC=A6=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implementation/StyleMonitor/SelectionStyleMonitor.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ST.Library.UI.STTextBox/Implementation/StyleMonitor/SelectionStyleMonitor.cs b/ST.Library.UI.STTextBox/Implementation/StyleMonitor/SelectionStyleMonitor.cs index 443d8dd..0a041ff 100644 --- a/ST.Library.UI.STTextBox/Implementation/StyleMonitor/SelectionStyleMonitor.cs +++ b/ST.Library.UI.STTextBox/Implementation/StyleMonitor/SelectionStyleMonitor.cs @@ -41,10 +41,14 @@ public void OnSelectionChanged(TextManager textManager, int nStart, int nLen) { } return false; }); - if (!string.IsNullOrEmpty(strKey)) { + if (!string.IsNullOrEmpty(strKey)) { string strText = textManager.GetText(); List lst = new List(); - foreach (Match m in Regex.Matches(strText, "\\b" + strKey + "\\b")) { + if ("* . ? + $ ^ [ ] ( ) { } | \\ /".Split(' ').Contains(strKey)) + { + strKey = "\\" + strKey; + } + foreach (Match m in Regex.Matches(strText, "\\b" + strKey + "\\b")) { // * . ? + $ ^ [ ] ( ) { } | \ / lst.Add(new TextStyleRange() { Index = m.Index, Length = m.Length,