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

LibLine: Display suggestions and cycle between them

With extra color (tm)
This commit also patches the users of LibLine to properly use the new
API
This commit is contained in:
AnotherTest 2020-04-11 19:02:15 +04:30 committed by Andreas Kling
parent b59a391a78
commit 2fdce695d6
4 changed files with 82 additions and 34 deletions

View file

@ -113,6 +113,11 @@ public:
m_spans_ending.clear();
m_refresh_needed = true;
}
void suggest(size_t invariant_offset = 0, size_t index = 0)
{
m_next_suggestion_index = index;
m_next_suggestion_invariant_offset = invariant_offset;
}
const struct termios& termios() const { return m_termios; }
const struct termios& default_termios() const { return m_default_termios; }
@ -190,6 +195,10 @@ private:
size_t m_origin_y { 0 };
String m_new_prompt;
Vector<String> m_suggestions;
String m_last_shown_suggestion;
size_t m_next_suggestion_index { 0 };
size_t m_next_suggestion_invariant_offset { 0 };
HashMap<char, NonnullOwnPtr<KeyCallback>> m_key_callbacks;