summaryrefslogtreecommitdiff
path: root/src/client.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-10-23 08:15:53 +1100
committerMaxime Coste <mawww@kakoune.org>2018-10-23 08:15:53 +1100
commitdfc11d1c43b898394df8fda52a8079b34058de27 (patch)
tree8d1923461be03b1d0eab5706740d22986a86997d /src/client.cc
parente399bf7562475c92f4f9e983d2261c12903072d4 (diff)
Refactor Hook management to have a well defined list of hooks
Hooks are now an enum class instead of passing strings around.
Diffstat (limited to 'src/client.cc')
-rw-r--r--src/client.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/client.cc b/src/client.cc
index 44702331..f72cbac1 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -57,7 +57,7 @@ Client::Client(std::unique_ptr<UserInterface>&& ui,
m_pending_keys.push_back(key);
});
- m_window->hooks().run_hook("WinDisplay", m_window->buffer().name(), context());
+ m_window->hooks().run_hook(Hook::WinDisplay, m_window->buffer().name(), context());
force_redraw();
}
@@ -91,20 +91,20 @@ bool Client::process_pending_inputs()
context().name(), key_to_str(key)));
if (key == Key::FocusIn)
- context().hooks().run_hook("FocusIn", context().name(), context());
+ context().hooks().run_hook(Hook::FocusIn, context().name(), context());
else if (key == Key::FocusOut)
- context().hooks().run_hook("FocusOut", context().name(), context());
+ context().hooks().run_hook(Hook::FocusOut, context().name(), context());
else
m_input_handler.handle_key(key);
- context().hooks().run_hook("RawKey", key_to_str(key), context());
+ context().hooks().run_hook(Hook::RawKey, key_to_str(key), context());
}
catch (Kakoune::runtime_error& error)
{
write_to_debug_buffer(format("Error: {}", error.what()));
context().print_status({ fix_atom_text(error.what().str()),
context().faces()["Error"] });
- context().hooks().run_hook("RuntimeError", error.what(), context());
+ context().hooks().run_hook(Hook::RuntimeError, error.what(), context());
}
}
return not keys.empty();
@@ -188,7 +188,7 @@ void Client::change_buffer(Buffer& buffer)
context().set_window(*m_window);
m_window->set_dimensions(m_ui->dimensions());
- m_window->hooks().run_hook("WinDisplay", buffer.name(), context());
+ m_window->hooks().run_hook(Hook::WinDisplay, buffer.name(), context());
force_redraw();
}
@@ -284,7 +284,7 @@ void Client::reload_buffer()
context().print_status({ format("'{}' reloaded", buffer.display_name()),
context().faces()["Information"] });
- m_window->hooks().run_hook("BufReload", buffer.name(), context());
+ m_window->hooks().run_hook(Hook::BufReload, buffer.name(), context());
}
catch (runtime_error& error)
{