Skip to content

Commit 19db651

Browse files
committed
fixed the bug. pull request([DebugST#1](DebugST#1))
1 parent 70dc796 commit 19db651

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class SelectionStyleMonitor : ITextStyleMonitor
1313

1414
private static WordSplitter m_spliter = new WordSplitter();
1515
private List<TextStyleRange> m_lst = new List<TextStyleRange>();
16+
private Regex m_reg_reg = new Regex(@"([*.?+$^\[\](){}|\\])");
1617

1718
public SelectionStyleMonitor() {
1819
this.Style = new TextStyle() {
@@ -41,7 +42,12 @@ public void OnSelectionChanged(TextManager textManager, int nStart, int nLen) {
4142
}
4243
return false;
4344
});
44-
if (!string.IsNullOrEmpty(strKey)) {
45+
// https://github.com/DebugST/STTextBox/pull/1
46+
//if ("* . ? + $ ^ [ ] ( ) { } | \\ /".Split(' ').Contains(strKey)) {
47+
// strKey = "\\" + strKey;
48+
//}
49+
strKey = m_reg_reg.Replace(strKey, @"\$1");
50+
if (!string.IsNullOrEmpty(strKey)) {
4551
string strText = textManager.GetText();
4652
List<TextStyleRange> lst = new List<TextStyleRange>();
4753
foreach (Match m in Regex.Matches(strText, "\\b" + strKey + "\\b")) {

ST.Library.UI.STTextBox/STTextBox.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ private void OnImeStartPrivate(IntPtr hIMC) {
464464
ptCurrentPos = m_core.Caret.Location
465465
};
466466
Win32.ImmSetCandidateWindow(hIMC, ref CandidateForm);
467+
467468
var CompositionForm = new Win32.COMPOSITIONFORM() {
468469
dwStyle = Win32.CFS_FORCE_POSITION,
469470
ptCurrentPos = m_core.Caret.Location

0 commit comments

Comments
 (0)