From 7086135fa65d47e4b53226e0beea7bc3f720a0be Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 11 Aug 2015 20:36:07 +0100 Subject: Display auto info on register insertion/explicit insert completion --- src/input_handler.hh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/input_handler.hh') diff --git a/src/input_handler.hh b/src/input_handler.hh index a39f634f..4b4e325f 100644 --- a/src/input_handler.hh +++ b/src/input_handler.hh @@ -8,6 +8,7 @@ #include "keys.hh" #include "string.hh" #include "utils.hh" +#include "user_interface.hh" #include "safe_ptr.hh" namespace Kakoune @@ -102,6 +103,20 @@ private: int m_handle_key_level = 0; }; +bool show_auto_info_ifn(StringView title, StringView info, const Context& context); + +template +void on_next_key_with_autoinfo(const Context& context, KeymapMode keymap_mode, Cmd cmd, + StringView title, StringView info) +{ + const bool hide = show_auto_info_ifn(title, info, context); + context.input_handler().on_next_key( + keymap_mode, [hide,cmd](Key key, Context& context) mutable { + if (hide) + context.ui().info_hide(); + cmd(key, context); + }); +} } #endif // input_handler_hh_INCLUDED -- cgit v1.2.3