1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:07:36 +00:00

LibGUI: Lex INI files as Utf8

Iterating byte by byte meant that the column positions assigned to INI
tokens would be off if there were any multi-byte codepoints. Using a
Utf8View means these positions refer to whole codepoints instead, and
the column positions match what GUI::TextEditor expects. :^)

Fixes #12706.
This commit is contained in:
Sam Atkins 2023-01-10 22:57:32 +00:00 committed by Jelle Raaijmakers
parent 95df712c2e
commit ae6a84c261
2 changed files with 14 additions and 16 deletions

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/StringView.h>
#include <AK/Utf8View.h>
namespace GUI {
@ -57,11 +57,11 @@ public:
Vector<IniToken> lex();
private:
char peek(size_t offset = 0) const;
char consume();
u32 peek(size_t offset = 0) const;
u32 consume();
StringView m_input;
size_t m_index { 0 };
Utf8View m_input;
Utf8CodePointIterator m_iterator;
IniPosition m_position { 0, 0 };
};