This repository was archived by the owner on May 9, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public void CheckAutocompletes()
41
41
suggestions.Clear();
42
42
43
43
int caret = Math.Max(0, Math.Min(InputField.Text.Length - 1, InputField.Component.caretPosition - 1));
44
- int start = caret;
44
+ int startIdx = caret;
45
45
46
46
// If the character at the caret index is whitespace or delimiter,
47
47
// or if the next character (if it exists) is not whitespace,
@@ -55,17 +55,20 @@ public void CheckAutocompletes()
55
55
}
56
56
57
57
// get the current composition string (from caret back to last delimiter)
58
- while (start > 0)
58
+ while (startIdx > 0)
59
59
{
60
- start --;
61
- char c = InputField.Text[start ];
60
+ startIdx --;
61
+ char c = InputField.Text[startIdx ];
62
62
if (delimiters.Contains(c))
63
63
{
64
- start++;
64
+ startIdx++;
65
+ while (char.IsWhiteSpace(InputField.Text[startIdx]))
66
+ startIdx++;
65
67
break;
66
68
}
67
69
}
68
- string input = InputField.Text.Substring(start, caret - start + 1);
70
+ string input = InputField.Text.Substring(startIdx, caret - startIdx + 1);
71
+
69
72
70
73
// Get MCS completions
71
74
Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ public override bool TryMatchCurrent(LexerBuilder lexer)
41
41
while (!lexer.EndOfInput && char.IsLetter(lexer.PeekNext()))
42
42
sb.Append(lexer.Current);
43
43
44
+ // next must be whitespace or delimiter
45
+ if (!lexer.EndOfInput && !(char.IsWhiteSpace(lexer.Current) || lexer.IsDelimiter(lexer.Current)))
46
+ return false;
47
+
44
48
if (keywords.Contains(sb.ToString()))
45
49
{
46
50
if (!lexer.EndOfInput)
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public class SymbolLexer : Lexer
11
11
protected override Color HighlightColor => new Color(0.6f, 0.6f, 0.6f);
12
12
13
13
// all symbols are delimiters
14
- public override IEnumerable<char> Delimiters => symbols;
14
+ public override IEnumerable<char> Delimiters => symbols.Where(it => it != '.'); // '.' is not a delimiter, only a separator.
15
15
16
16
public static bool IsSymbol(char c) => symbols.Contains(c);
17
17
You can’t perform that action at this time.
0 commit comments