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

LibLine: Default to resolving Spans as byte offsets

This allows all the unicode processing to be internal to the line
editor.
This commit is contained in:
AnotherTest 2020-05-18 21:35:01 +04:30 committed by Andreas Kling
parent 379cb061d7
commit c38c2668da
2 changed files with 57 additions and 9 deletions

View file

@ -30,17 +30,25 @@
namespace Line {
class Span {
public:
Span(size_t start, size_t end)
enum Mode {
ByteOriented,
CodepointOriented,
};
Span(size_t start, size_t end, Mode mode = ByteOriented)
: m_beginning(start)
, m_end(end)
, m_mode(mode)
{
}
size_t beginning() const { return m_beginning; }
size_t end() const { return m_end; }
Mode mode() const { return m_mode; }
private:
size_t m_beginning { 0 };
size_t m_end { 0 };
Mode m_mode { CodepointOriented };
};
}