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

LibLine+Userland: Make suggestion offsets per-suggestion

This allows the user to modify different parts of the input with
different suggestions.
This commit is contained in:
Ali Mohammad Pur 2022-02-28 17:28:47 +03:30 committed by Andreas Kling
parent 1fcef99ff7
commit 118590325a
6 changed files with 79 additions and 51 deletions

View file

@ -53,6 +53,8 @@ public:
Style style;
size_t start_index { 0 };
size_t input_offset { 0 };
size_t static_offset { 0 };
size_t invariant_offset { 0 };
Utf32View text_view;
Utf32View trivia_view;
@ -102,12 +104,6 @@ public:
void next();
void previous();
void set_suggestion_variants(size_t static_offset, size_t invariant_offset, size_t suggestion_index) const
{
m_next_suggestion_index = suggestion_index;
m_next_suggestion_static_offset = static_offset;
m_next_suggestion_invariant_offset = invariant_offset;
}
CompletionSuggestion const& suggest();
CompletionSuggestion const& current_suggestion() const { return m_last_shown_suggestion; }
@ -131,8 +127,6 @@ private:
size_t m_last_shown_suggestion_display_length { 0 };
bool m_last_shown_suggestion_was_complete { false };
mutable size_t m_next_suggestion_index { 0 };
mutable size_t m_next_suggestion_invariant_offset { 0 };
mutable size_t m_next_suggestion_static_offset { 0 };
size_t m_largest_common_suggestion_prefix_length { 0 };
mutable size_t m_last_displayed_suggestion_index { 0 };
size_t m_selected_suggestion_index { 0 };