Fix string/comment state being incorrect if match ended at last character

This commit is contained in:
Sinai 2021-06-03 17:18:46 +10:00
parent aaab10a0a0
commit 97c20144f1

View File

@ -113,7 +113,7 @@ namespace UnityExplorer.UI.CSConsole
sb.Append(SignatureHighlighter.CLOSE_COLOR);
// check caretIdx to determine inStringOrComment state
if (caretIdx >= match.startIndex && caretIdx <= match.endIndex)
if (caretIdx >= match.startIndex && (caretIdx <= match.endIndex || (caretIdx >= input.Length && match.endIndex >= input.Length - 1)))
caretInStringOrComment = match.isStringOrComment;
// update the last unhighlighted start index