From 2cfe3cae36cb9054b37a351de0d7b60a0e5bd4ca Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 30 Mar 2017 10:38:56 +0100 Subject: Add an InsertDelete hook --- src/input_handler.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/input_handler.cc') diff --git a/src/input_handler.cc b/src/input_handler.cc index b25e4174..b9a1653c 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1067,8 +1067,14 @@ public: auto pos = sel.cursor(); sels.emplace_back(buffer.char_prev(pos)); } + auto& main = context().selections().main(); + String main_char = buffer.string(buffer.char_prev(main.cursor()), + main.cursor()); if (not sels.empty()) SelectionList{buffer, std::move(sels)}.erase(); + + if (not main_char.empty()) + context().hooks().run_hook("InsertDelete", main_char, context()); } else if (key == Key::Delete) { -- cgit v1.2.3