summaryrefslogtreecommitdiff
path: root/src/input_handler.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-08-11 20:36:07 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-08-11 20:36:07 +0100
commit7086135fa65d47e4b53226e0beea7bc3f720a0be (patch)
treec540f1f83008b20eb5c47497369cc6d5d962d4a6 /src/input_handler.hh
parentdac4fdaa54e0290a10c301835ab51140c2cd2bd7 (diff)
Display auto info on register insertion/explicit insert completion
Diffstat (limited to 'src/input_handler.hh')
-rw-r--r--src/input_handler.hh15
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