Display a [no-hooks] tag in the mode line when hooks are disabled
This commit is contained in:
parent
6813440212
commit
8d6e8bc06f
|
@ -64,6 +64,8 @@ DisplayLine Client::generate_mode_line() const
|
||||||
status.push_back({ "[recording ("_str + m_input_handler.recording_reg() + ")]", info_face });
|
status.push_back({ "[recording ("_str + m_input_handler.recording_reg() + ")]", info_face });
|
||||||
if (context().buffer().flags() & Buffer::Flags::New)
|
if (context().buffer().flags() & Buffer::Flags::New)
|
||||||
status.push_back({ "[new file]", info_face });
|
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)
|
if (context().buffer().flags() & Buffer::Flags::Fifo)
|
||||||
status.push_back({ "[fifo]", info_face });
|
status.push_back({ "[fifo]", info_face });
|
||||||
status.push_back({ " ", status_face });
|
status.push_back({ " ", status_face });
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
if (do_restore_hooks)
|
if (do_restore_hooks)
|
||||||
{
|
{
|
||||||
context().enable_user_hooks();
|
context().enable_user_hooks();
|
||||||
m_disable_hooks = false;
|
m_hooks_disabled = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -100,14 +100,14 @@ public:
|
||||||
else if (key == Key::Backspace)
|
else if (key == Key::Backspace)
|
||||||
m_count /= 10;
|
m_count /= 10;
|
||||||
else if (key == '\\')
|
else if (key == '\\')
|
||||||
m_disable_hooks = true;
|
{
|
||||||
|
m_hooks_disabled = true;
|
||||||
|
context().disable_user_hooks();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_disable_hooks)
|
if (m_hooks_disabled)
|
||||||
{
|
|
||||||
context().disable_user_hooks();
|
|
||||||
do_restore_hooks = true;
|
do_restore_hooks = true;
|
||||||
}
|
|
||||||
auto it = keymap.find(key);
|
auto it = keymap.find(key);
|
||||||
if (it != keymap.end())
|
if (it != keymap.end())
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_count = 0;
|
int m_count = 0;
|
||||||
bool m_disable_hooks = false;
|
bool m_hooks_disabled = false;
|
||||||
Timer m_idle_timer;
|
Timer m_idle_timer;
|
||||||
Timer m_fs_check_timer;
|
Timer m_fs_check_timer;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user