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

LibLine: Make suggest() utf8-aware

This commit is contained in:
AnotherTest 2020-05-21 15:15:56 +04:30 committed by Andreas Kling
parent e0312ec2ce
commit e2886aabcd
2 changed files with 69 additions and 29 deletions

View file

@ -176,12 +176,8 @@ public:
// ^ ^
// +-|- static offset: the suggestions start here
// +- invariant offset: the suggestions do not change up to here
void suggest(size_t invariant_offset = 0, size_t static_offset = 0) const
{
m_next_suggestion_index = 0;
m_next_suggestion_static_offset = static_offset;
m_next_suggestion_invariant_offset = invariant_offset;
}
//
void suggest(size_t invariant_offset = 0, size_t static_offset = 0, Span::Mode offset_mode = Span::ByteOriented) const;
const struct termios& termios() const { return m_termios; }
const struct termios& default_termios() const { return m_default_termios; }
@ -293,6 +289,12 @@ private:
void recalculate_origin();
void reposition_cursor();
struct CodepointRange {
size_t start { 0 };
size_t end { 0 };
};
CodepointRange byte_offset_range_to_codepoint_offset_range(size_t byte_start, size_t byte_end, size_t codepoint_scan_offset, bool reverse = false) const;
bool m_finish { false };
OwnPtr<Editor> m_search_editor;