diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-04-19 12:43:36 +0430 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-04-19 16:28:33 +0200 |
commit | e1e84fe0fef8a844bb54d07258c32e24ef1f96d5 (patch) | |
tree | 267cb429920884037d3a5b004701932191b89ae7 /Userland/Libraries/LibLine/SuggestionDisplay.h | |
parent | 3cfab83e7e87ec062c717259e0f1c16f3b579a89 (diff) | |
download | serenity-e1e84fe0fef8a844bb54d07258c32e24ef1f96d5.zip |
LibLine: Redraw the suggestions when terminal size changes
Diffstat (limited to 'Userland/Libraries/LibLine/SuggestionDisplay.h')
-rw-r--r-- | Userland/Libraries/LibLine/SuggestionDisplay.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Libraries/LibLine/SuggestionDisplay.h b/Userland/Libraries/LibLine/SuggestionDisplay.h index 434b0ee3a2..2dc24be2ad 100644 --- a/Userland/Libraries/LibLine/SuggestionDisplay.h +++ b/Userland/Libraries/LibLine/SuggestionDisplay.h @@ -44,6 +44,17 @@ public: virtual void finish() = 0; virtual void set_initial_prompt_lines(size_t) = 0; + void redisplay(const SuggestionManager& manager, size_t lines, size_t columns) + { + if (m_is_showing_suggestions) { + cleanup(); + set_vt_size(lines, columns); + display(manager); + } else { + set_vt_size(lines, columns); + } + } + virtual void set_vt_size(size_t lines, size_t columns) = 0; size_t origin_row() const { return m_origin_row; } @@ -56,8 +67,12 @@ public: } protected: + void did_display() { m_is_showing_suggestions = true; } + void did_cleanup() { m_is_showing_suggestions = false; } + int m_origin_row { 0 }; int m_origin_column { 0 }; + bool m_is_showing_suggestions { false }; }; class XtermSuggestionDisplay : public SuggestionDisplay { |