diff options
Diffstat (limited to 'src/input_handler.hh')
| -rw-r--r-- | src/input_handler.hh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/input_handler.hh b/src/input_handler.hh index 3638785b..8c93c141 100644 --- a/src/input_handler.hh +++ b/src/input_handler.hh @@ -11,6 +11,7 @@ #include "utils.hh" #include "safe_ptr.hh" #include "display_buffer.hh" +#include "event_manager.hh" namespace Kakoune { @@ -80,7 +81,8 @@ public: // execute callback on next keypress and returns to normal mode // if callback does not change the mode itself - void on_next_key(StringView mode_name, KeymapMode mode, KeyCallback callback); + void on_next_key(StringView mode_name, KeymapMode mode, KeyCallback callback, + Timer::Callback idle_callback = Timer::Callback{}); // process the given key void handle_key(Key key); @@ -171,19 +173,22 @@ constexpr auto enum_desc(Meta::Type<AutoComplete>) }); } +bool should_show_info(AutoInfo mask, const Context& context); bool show_auto_info_ifn(StringView title, StringView info, AutoInfo mask, const Context& context); void hide_auto_info_ifn(const Context& context, bool hide); template<typename Cmd> void on_next_key_with_autoinfo(const Context& context, StringView mode_name, KeymapMode keymap_mode, Cmd cmd, - StringView title, StringView info) + String title, String info) { - const bool hide = show_auto_info_ifn(title, info, AutoInfo::OnKey, context); context.input_handler().on_next_key(mode_name, - keymap_mode, [hide,cmd](Key key, Context& context) mutable { + keymap_mode, [cmd](Key key, Context& context) mutable { + bool hide = should_show_info(AutoInfo::OnKey, context); hide_auto_info_ifn(context, hide); cmd(key, context); + }, [&context, title=std::move(title), info=std::move(info)](Timer&) { + show_auto_info_ifn(title, info, AutoInfo::OnKey, context); }); } |
