diff options
author | Max Wipfli <mail@maxwipfli.ch> | 2021-06-04 00:05:33 +0200 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-06-05 00:32:28 +0430 |
commit | cb5a50d3f7cee837d1d620e6818a86e7e98d669a (patch) | |
tree | c9540a468ce40d60f1ff3f06e80ea05792ae9b67 /Userland/DevTools | |
parent | e7b5dbe1acd5d53ffc7f4821aad1caf69c0b2749 (diff) | |
download | serenity-cb5a50d3f7cee837d1d620e6818a86e7e98d669a.zip |
LibGUI: Fix off-by-one error in Lexer tokens
This changes the INI and GML lexers to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.
The other user of GMLToken::m_end, GMLAutocompleteProvider, has been
modified to take into account that end position columns have been
incremented by one.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r-- | Userland/DevTools/Playground/GMLAutocompleteProvider.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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<void(Vector<Entry>)> Vector<GUI::AutocompleteProvider::Entry> 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<void(Vector<Entry>)> 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<void(Vector<Entry>)> 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<void(Vector<Entry>)> } 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; |