Skip to content

Commit 9bb5b92

Browse files
committed
fixed: pull request([DebugST#1](DebugST#1))
2 parents 19db651 + 316c51a commit 9bb5b92

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ST.Library.UI.STTextBox/Implementation/StyleMonitor/SelectionStyleMonitor.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public void OnSelectionChanged(TextManager textManager, int nStart, int nLen) {
4242
}
4343
return false;
4444
});
45+
4546
// https://github.com/DebugST/STTextBox/pull/1
4647
//if ("* . ? + $ ^ [ ] ( ) { } | \\ /".Split(' ').Contains(strKey)) {
4748
// strKey = "\\" + strKey;
@@ -50,7 +51,11 @@ public void OnSelectionChanged(TextManager textManager, int nStart, int nLen) {
5051
if (!string.IsNullOrEmpty(strKey)) {
5152
string strText = textManager.GetText();
5253
List<TextStyleRange> lst = new List<TextStyleRange>();
53-
foreach (Match m in Regex.Matches(strText, "\\b" + strKey + "\\b")) {
54+
if ("* . ? + $ ^ [ ] ( ) { } | \\ /".Split(' ').Contains(strKey))
55+
{
56+
strKey = "\\" + strKey;
57+
}
58+
foreach (Match m in Regex.Matches(strText, "\\b" + strKey + "\\b")) { // * . ? + $ ^ [ ] ( ) { } | \ /
5459
lst.Add(new TextStyleRange() {
5560
Index = m.Index,
5661
Length = m.Length,

0 commit comments

Comments
 (0)