Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit a9ccfbf

Browse files
committed
Fix highlighting
1 parent 5885fe4 commit a9ccfbf

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

UI/Components/EditorElementHighlighter.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Globalization;
44
using System.Linq;
@@ -202,20 +202,27 @@ public HighlightingRuleSet MainRuleSet
202202
{Foreground = new SimpleHighlightingBrush(Program.OptionsObject.SH_Methods)}
203203
});
204204

205+
if (def.FieldStrings.Length > 0)
206+
rs.Rules.Add(new HighlightingRule //Methods
207+
{
208+
Regex = RegexKeywordsHelper.GetRegexFromKeywords2(def.FieldStrings),
209+
Color = new HighlightingColor
210+
{Foreground = new SimpleHighlightingBrush(Program.OptionsObject.SH_Methods)}
211+
});
212+
205213
if (def.StructFieldStrings.Length > 0)
206214
rs.Rules.Add(new HighlightingRule //Methods
207215
{
208-
Regex = RegexKeywordsHelper.GetRegexFromKeywords(
209-
def.StructFieldStrings.Select(e => e).ToArray(), true),
216+
Regex = RegexKeywordsHelper.GetRegexFromKeywords2(def.StructFieldStrings),
210217
Color = new HighlightingColor
211218
{Foreground = new SimpleHighlightingBrush(Program.OptionsObject.SH_Methods)}
212219
});
213220

214221
if (def.StructMethodStrings.Length > 0)
215222
rs.Rules.Add(new HighlightingRule //Methods
216223
{
217-
Regex = RegexKeywordsHelper.GetRegexFromKeywords(
218-
def.StructMethodStrings.Select(e => e).ToArray(), true),
224+
Regex = RegexKeywordsHelper.GetRegexFromKeywords2(
225+
def.StructMethodStrings),
219226
Color = new HighlightingColor
220227
{Foreground = new SimpleHighlightingBrush(Program.OptionsObject.SH_Methods)}
221228
});
@@ -370,7 +377,7 @@ public static string[] ConvertToAtomicRegexAbleStringArray(string[] keywords)
370377

371378
public static Regex GetRegexFromKeywords2(string[] keywords)
372379
{
373-
var regexBuilder = new StringBuilder(@"\b[^\s]+\.(");
380+
var regexBuilder = new StringBuilder(@"\b(?<=[^\s]+\.)(");
374381
var i = 0;
375382
foreach (var keyword in keywords)
376383
{

0 commit comments

Comments
 (0)