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/input_handler.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/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index 89613aee..56999d45 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -212,14 +212,6 @@ constexpr StringView register_doc = class Normal : public InputMode { - enum class PendingClear - { - None = 0, - Info = 0b01, - StatusLine = 0b10 - }; - friend constexpr bool with_bit_ops(Meta::Type<PendingClear>) { return true; } - public: Normal(InputHandler& input_handler, bool single_command = false) : InputMode(input_handler), @@ -228,13 +220,7 @@ public: Timer::Callback{} : [this](Timer&) { RefPtr<InputMode> keep_alive{this}; // hook could trigger pop_mode() if (context().has_client()) - { - if (m_pending_clear & PendingClear::StatusLine) - context().client().print_status({}); - if (m_pending_clear & PendingClear::Info) - context().client().info_hide(); - } - m_pending_clear = PendingClear::None; + context().client().clear_pending(); context().hooks().run_hook(Hook::NormalIdle, "", context()); }}, @@ -381,8 +367,7 @@ public: if (enabled() and not transient) // The hook might have changed mode { if (should_clear and context().has_client()) - m_pending_clear = (context().client().info_pending() ? PendingClear::None : PendingClear::Info) - | (context().client().status_line_pending() ? PendingClear::None : PendingClear::StatusLine); + context().client().schedule_clear(); m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context())); } } @@ -416,7 +401,7 @@ public: if (not (context().flags() & Context::Flags::Draft)) { if (context().has_client()) - m_pending_clear = PendingClear::Info | PendingClear::StatusLine; + context().client().schedule_clear(); m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context())); } } @@ -434,7 +419,6 @@ private: Timer m_idle_timer; Timer m_fs_check_timer; MouseHandler m_mouse_handler; - PendingClear m_pending_clear = PendingClear::None; enum class State { Normal, SingleCommand, PopOnEnabled }; State m_state; |
