From d22c989984348dc407fcebff565267f15384b0d9 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 21 Jan 2018 10:34:09 +1100 Subject: [PATCH] Rename InputModeChange hook to ModeChange InputModeChange is a bit long to type and its pretty clear in Kakoune that "Mode" means "Input mode", so use a shorter and as clear name. --- doc/pages/hooks.asciidoc | 2 +- src/commands.cc | 2 +- src/input_handler.cc | 6 +++--- src/main.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/pages/hooks.asciidoc b/doc/pages/hooks.asciidoc index 0dfa6fc1..ca2fbf4a 100644 --- a/doc/pages/hooks.asciidoc +++ b/doc/pages/hooks.asciidoc @@ -120,7 +120,7 @@ of the given *group*. *RuntimeError* `error message`:: an error was encountered while executing a user command -*InputModeChange* `:`:: +*ModeChange* `:`:: Triggered whenever the current input mode changes *KakBegin* `session name`:: diff --git a/src/commands.cc b/src/commands.cc index 330f45fb..8101a6f1 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -758,7 +758,7 @@ static constexpr auto hooks = { "InsertBegin", "InsertChar", "InsertDelete", "InsertEnd", "InsertIdle", "InsertKey", "InsertMove", "InsertCompletionHide", "InsertCompletionShow", "InsertCompletionSelect", "KakBegin", "KakEnd", "FocusIn", "FocusOut", "RuntimeError", "PromptIdle", - "NormalBegin", "NormalEnd", "NormalIdle", "NormalKey", "InputModeChange", "RawKey", + "NormalBegin", "NormalEnd", "NormalIdle", "NormalKey", "ModeChange", "RawKey", "WinClose", "WinCreate", "WinDisplay", "WinResize", "WinSetOption", }; diff --git a/src/input_handler.cc b/src/input_handler.cc index 93496a6c..f8211a2e 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1418,7 +1418,7 @@ void InputHandler::push_mode(InputMode* new_mode) m_mode_stack.emplace_back(new_mode); new_mode->on_enabled(); - context().hooks().run_hook("InputModeChange", format("{}:{}", prev_name, new_mode->name()), context()); + context().hooks().run_hook("ModeChange", format("{}:{}", prev_name, new_mode->name()), context()); } void InputHandler::pop_mode(InputMode* mode) @@ -1432,7 +1432,7 @@ void InputHandler::pop_mode(InputMode* mode) m_mode_stack.pop_back(); current_mode().on_enabled(); - context().hooks().run_hook("InputModeChange", format("{}:{}", prev_name, current_mode().name()), context()); + context().hooks().run_hook("ModeChange", format("{}:{}", prev_name, current_mode().name()), context()); } void InputHandler::reset_normal_mode() @@ -1446,7 +1446,7 @@ void InputHandler::reset_normal_mode() m_mode_stack.resize(1); current_mode().on_enabled(); - context().hooks().run_hook("InputModeChange", format("{}:{}", prev_name, current_mode().name()), context()); + context().hooks().run_hook("ModeChange", format("{}:{}", prev_name, current_mode().name()), context()); } void InputHandler::insert(InsertMode mode, int count) diff --git a/src/main.cc b/src/main.cc index c18af600..ad5646f8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -46,7 +46,7 @@ static const char* startup_info = " the add-highlighter and remove-highlighter command syntax changed.\n" " * Regex implementation switched to a custom one, the syntax is slightly\n" " less tolerant.\n" -" * InputModeChange hook has been introduced and is expected to replace\n" +" * ModeChange hook has been introduced and is expected to replace\n" " the various ${MODE}Begin/${MODE}End hooks, consider those deprecated.\n"; struct startup_error : runtime_error