diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-05-21 15:15:56 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-23 01:31:41 +0200 |
commit | e2886aabcd274fbb17207204d68779b921e8c44a (patch) | |
tree | 4f42922df7f44df1ef2b11d788d8b3a508457588 /Libraries/LibLine/Editor.h | |
parent | e0312ec2ced7dab0fa9fbe6315df96e50ffddf4e (diff) | |
download | serenity-e2886aabcd274fbb17207204d68779b921e8c44a.zip |
LibLine: Make suggest() utf8-aware
Diffstat (limited to 'Libraries/LibLine/Editor.h')
-rw-r--r-- | Libraries/LibLine/Editor.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Libraries/LibLine/Editor.h b/Libraries/LibLine/Editor.h index 9ececd76ad..92d127e889 100644 --- a/Libraries/LibLine/Editor.h +++ b/Libraries/LibLine/Editor.h @@ -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; |