diff options
Diffstat (limited to 'src/input_handler.hh')
| -rw-r--r-- | src/input_handler.hh | 15 |
1 files changed, 15 insertions, 0 deletions
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<typename Cmd> +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 |
