diff --git a/source/main.pas b/source/main.pas index 8819a85c..7d8cf747 100644 --- a/source/main.pas +++ b/source/main.pas @@ -4125,8 +4125,8 @@ begin rx := TRegExpr.Create; // Find longer token, ignore EndOfTokenChars, just the last chars up to a whitespace, comma or paranthesis - rx.Expression := '([^\s,\(\)]+).$'; - PrevLongToken := Copy(Editor.LineText, 0, x); + rx.Expression := '([^\s,\(\)]+)$'; + PrevLongToken := Copy(Editor.LineText, 1, Editor.CaretX-2); if rx.Exec(PrevLongToken) then PrevLongToken := rx.Match[1] else