Display a [no-hooks] tag in the mode line when hooks are disabled

This commit is contained in:
Maxime Coste 2014-07-25 23:47:47 +01:00
parent 6813440212
commit 8d6e8bc06f
2 changed files with 9 additions and 7 deletions

View File

@ -64,6 +64,8 @@ DisplayLine Client::generate_mode_line() const
status.push_back({ "[recording ("_str + m_input_handler.recording_reg() + ")]", info_face });
if (context().buffer().flags() & Buffer::Flags::New)
status.push_back({ "[new file]", info_face });
if (context().are_user_hooks_disabled())
status.push_back({ "[no-hooks]", info_face });
if (context().buffer().flags() & Buffer::Flags::Fifo)
status.push_back({ "[fifo]", info_face });
status.push_back({ " ", status_face });

View File

@ -87,7 +87,7 @@ public:
if (do_restore_hooks)
{
context().enable_user_hooks();
m_disable_hooks = false;
m_hooks_disabled = false;
}
});
@ -100,14 +100,14 @@ public:
else if (key == Key::Backspace)
m_count /= 10;
else if (key == '\\')
m_disable_hooks = true;
{
m_hooks_disabled = true;
context().disable_user_hooks();
}
else
{
if (m_disable_hooks)
{
context().disable_user_hooks();
if (m_hooks_disabled)
do_restore_hooks = true;
}
auto it = keymap.find(key);
if (it != keymap.end())
{
@ -137,7 +137,7 @@ public:
private:
int m_count = 0;
bool m_disable_hooks = false;
bool m_hooks_disabled = false;
Timer m_idle_timer;
Timer m_fs_check_timer;
};