diff --git a/LogGrokCore/Controls/TextRender/TextControl.cs b/LogGrokCore/Controls/TextRender/TextControl.cs index a485f86..81b94a5 100644 --- a/LogGrokCore/Controls/TextRender/TextControl.cs +++ b/LogGrokCore/Controls/TextRender/TextControl.cs @@ -323,6 +323,9 @@ private static (int start, int length) GetWordSelectionRange(StringRange lineTex left--; } + if (position >= span.Length) + return (left, span.Length - left); + var right = position; while (right < span.Length - 1 && IsWordPart(span[right + 1])) {