From 12deb7d5dad2a0703d0f6e2f683a4c32f6ff7ae3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 17 Jul 2024 19:59:18 +1000 Subject: Clear info box and prompt on paste --- src/input_handler.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/input_handler.cc') diff --git a/src/input_handler.cc b/src/input_handler.cc index 99fb684e..eb809b5f 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -23,6 +23,13 @@ namespace Kakoune { +static void clear_info_and_echo(Context& context) +{ + context.print_status({}); + if (context.has_client()) + context.client().info_hide(); +} + class InputMode : public RefCountable { public: @@ -97,6 +104,8 @@ void InputMode::paste(StringView content) context().print_status({error.what().str(), context().faces()["Error"] }); context().hooks().run_hook(Hook::RuntimeError, error.what(), context()); } + + clear_info_and_echo(context()); } namespace InputModes @@ -285,9 +294,7 @@ public: if (m_mouse_handler.handle_key(key, context())) { - context().print_status({}); - if (context().has_client()) - context().client().info_hide(); + clear_info_and_echo(context()); if (not transient) m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context())); @@ -334,9 +341,7 @@ public: m_state = State::PopOnEnabled; }); - context().print_status({}); - if (context().has_client()) - context().client().info_hide(); + clear_info_and_echo(context()); // Hack to parse keys sent by terminals using the 8th bit to mark the // meta key. In normal mode, give priority to a potential alt-key than -- cgit v1.2.3