This commit is contained in:
ryuukk 2023-11-15 13:12:01 +01:00 committed by GitHub
commit aade7f7544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -115,7 +115,7 @@ class AutocompleteParser : Parser
{ {
if (!currentIs(tok!"{")) if (!currentIs(tok!"{"))
return null; return null;
if (current.index > cursorPosition) if (cursorPosition != -1 && current.index > cursorPosition)
{ {
BlockStatement bs = allocator.make!(BlockStatement); BlockStatement bs = allocator.make!(BlockStatement);
bs.startLocation = current.index; bs.startLocation = current.index;
@ -126,7 +126,7 @@ class AutocompleteParser : Parser
immutable start = current.index; immutable start = current.index;
auto b = setBookmark(); auto b = setBookmark();
skipBraces(); skipBraces();
if (tokens[index - 1].index < cursorPosition) if (cursorPosition != -1 && tokens[index - 1].index < cursorPosition)
{ {
abandonBookmark(b); abandonBookmark(b);
BlockStatement bs = allocator.make!BlockStatement(); BlockStatement bs = allocator.make!BlockStatement();
@ -142,7 +142,7 @@ class AutocompleteParser : Parser
} }
private: private:
size_t cursorPosition; long cursorPosition;
} }
class SimpleParser : Parser class SimpleParser : Parser