diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-08-12 17:10:12 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-08-12 17:10:12 +1000 |
| commit | a250b96c18659d34d50e13de8d5126ca7fed6814 (patch) | |
| tree | be08cbd44915d60d39a34389cadda04b1bfd66b5 /src/client.cc | |
| parent | 6af7a847c74a05748ba139aed6386c0a6df0220b (diff) | |
Move most info/status clear logic to client
This makes it possible to remove the pending clears whenever an
info/status line is explicitely added, removing a class of race
conditions introduced by the previous implementation.
Diffstat (limited to 'src/client.cc')
| -rw-r--r-- | src/client.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/client.cc b/src/client.cc index 7cfea960..8b084fd5 100644 --- a/src/client.cc +++ b/src/client.cc @@ -130,6 +130,7 @@ void Client::print_status(DisplayLine status_line) { m_status_line = std::move(status_line); m_ui_pending |= StatusLine; + m_pending_clear &= ~PendingClear::StatusLine; } @@ -467,6 +468,7 @@ void Client::info_show(DisplayLine title, DisplayLineList content, BufferCoord a m_info = Info{ std::move(title), std::move(content), anchor, {}, style }; m_ui_pending |= InfoShow; m_ui_pending &= ~InfoHide; + m_pending_clear &= ~PendingClear::Info; } void Client::info_show(StringView title, StringView content, BufferCoord anchor, InfoStyle style) @@ -490,4 +492,21 @@ void Client::info_hide(bool even_modal) m_ui_pending &= ~InfoShow; } +void Client::schedule_clear() +{ + if (not (m_ui_pending & InfoShow)) + m_pending_clear |= PendingClear::Info; + if (not (m_ui_pending & StatusLine)) + m_pending_clear |= PendingClear::StatusLine; +} + +void Client::clear_pending() +{ + if (m_pending_clear & PendingClear::StatusLine) + print_status({}); + if (m_pending_clear & PendingClear::Info) + info_hide(); + m_pending_clear = PendingClear::None; +} + } |
