diff --git a/Userland/DevTools/Playground/GMLAutocompleteProvider.cpp b/Userland/DevTools/Playground/GMLAutocompleteProvider.cpp index 37c78e7fa4..4fc0b46562 100644 --- a/Userland/DevTools/Playground/GMLAutocompleteProvider.cpp +++ b/Userland/DevTools/Playground/GMLAutocompleteProvider.cpp @@ -107,7 +107,7 @@ void GMLAutocompleteProvider::provide_completions(Function)> Vector class_entries, identifier_entries; switch (state) { case Free: - if (last_seen_token && last_seen_token->m_end.column + 1 != cursor.column() && last_seen_token->m_end.line == cursor.line()) { + if (last_seen_token && last_seen_token->m_end.column != cursor.column() && last_seen_token->m_end.line == cursor.line()) { // After some token, but with extra space, not on a new line. // Nothing to put here. break; @@ -121,7 +121,7 @@ void GMLAutocompleteProvider::provide_completions(Function)> case InClassName: if (class_names.is_empty()) break; - if (last_seen_token && last_seen_token->m_end.column + 1 != cursor.column() && last_seen_token->m_end.line == cursor.line()) { + if (last_seen_token && last_seen_token->m_end.column != cursor.column() && last_seen_token->m_end.line == cursor.line()) { // After a class name, but haven't seen braces. // TODO: Suggest braces? break; @@ -136,7 +136,7 @@ void GMLAutocompleteProvider::provide_completions(Function)> case InIdentifier: { if (class_names.is_empty()) break; - if (last_seen_token && last_seen_token->m_end.column + 1 != cursor.column() && last_seen_token->m_end.line == cursor.line()) { + if (last_seen_token && last_seen_token->m_end.column != cursor.column() && last_seen_token->m_end.line == cursor.line()) { // After an identifier, but with extra space // TODO: Maybe suggest a colon? break; @@ -158,7 +158,7 @@ void GMLAutocompleteProvider::provide_completions(Function)> } case AfterClassName: { if (last_seen_token && last_seen_token->m_end.line == cursor.line()) { - if (last_seen_token->m_type != GUI::GMLToken::Type::Identifier || last_seen_token->m_end.column + 1 != cursor.column()) { + if (last_seen_token->m_type != GUI::GMLToken::Type::Identifier || last_seen_token->m_end.column != cursor.column()) { // Inside braces, but on the same line as some other stuff (and not the continuation of one!) // The user expects nothing here. break; diff --git a/Userland/Libraries/LibGUI/GMLLexer.cpp b/Userland/Libraries/LibGUI/GMLLexer.cpp index 9c30d0656e..e884e087ca 100644 --- a/Userland/Libraries/LibGUI/GMLLexer.cpp +++ b/Userland/Libraries/LibGUI/GMLLexer.cpp @@ -26,7 +26,6 @@ char GMLLexer::consume() { VERIFY(m_index < m_input.length()); char ch = m_input[m_index++]; - m_previous_position = m_position; if (ch == '\n') { m_position.line++; m_position.column = 0; @@ -68,7 +67,7 @@ Vector GMLLexer::lex() token.m_view = m_input.substring_view(token_start_index, m_index - token_start_index); token.m_type = type; token.m_start = token_start_position; - token.m_end = m_previous_position; + token.m_end = m_position; tokens.append(token); }; diff --git a/Userland/Libraries/LibGUI/GMLLexer.h b/Userland/Libraries/LibGUI/GMLLexer.h index 50214cbc58..9e418c6cae 100644 --- a/Userland/Libraries/LibGUI/GMLLexer.h +++ b/Userland/Libraries/LibGUI/GMLLexer.h @@ -63,7 +63,6 @@ private: StringView m_input; size_t m_index { 0 }; - GMLPosition m_previous_position { 0, 0 }; GMLPosition m_position { 0, 0 }; }; diff --git a/Userland/Libraries/LibGUI/INILexer.cpp b/Userland/Libraries/LibGUI/INILexer.cpp index d602059ae0..ce2c850d99 100644 --- a/Userland/Libraries/LibGUI/INILexer.cpp +++ b/Userland/Libraries/LibGUI/INILexer.cpp @@ -26,7 +26,6 @@ char IniLexer::consume() { VERIFY(m_index < m_input.length()); char ch = m_input[m_index++]; - m_previous_position = m_position; if (ch == '\n') { m_position.line++; m_position.column = 0; @@ -47,9 +46,9 @@ Vector IniLexer::lex() IniToken token; token.m_type = type; token.m_start = m_position; + consume(); token.m_end = m_position; tokens.append(token); - consume(); }; auto begin_token = [&] { diff --git a/Userland/Libraries/LibGUI/INILexer.h b/Userland/Libraries/LibGUI/INILexer.h index 288884a9fa..f6a01e08f3 100644 --- a/Userland/Libraries/LibGUI/INILexer.h +++ b/Userland/Libraries/LibGUI/INILexer.h @@ -62,7 +62,6 @@ private: StringView m_input; size_t m_index { 0 }; - IniPosition m_previous_position { 0, 0 }; IniPosition m_position { 0, 0 }; };