Disable idle timers on all transient contexts

This commit is contained in:
Maxime Coste 2017-06-08 09:53:23 +01:00
parent 609b0bbbac
commit 4ab40af3a9

View File

@ -160,16 +160,16 @@ public:
: InputMode(input_handler), : InputMode(input_handler),
m_idle_timer{TimePoint::max(), m_idle_timer{TimePoint::max(),
context().flags() & Context::Flags::Transient ? context().flags() & Context::Flags::Transient ?
Timer::Callback() : Timer::Callback([this](Timer& timer) { Timer::Callback{} : [this](Timer&) {
context().hooks().run_hook("NormalIdle", "", context()); context().hooks().run_hook("NormalIdle", "", context());
})}, }},
m_fs_check_timer{TimePoint::max(), m_fs_check_timer{TimePoint::max(),
context().flags() & Context::Flags::Transient ? context().flags() & Context::Flags::Transient ?
Timer::Callback() : Timer::Callback([this](Timer& timer) { Timer::Callback{} : Timer::Callback{[this](Timer& timer) {
if (context().has_client()) if (context().has_client())
context().client().check_if_buffer_needs_reloading(); context().client().check_if_buffer_needs_reloading();
timer.set_next_date(Clock::now() + get_fs_check_timeout(context())); timer.set_next_date(Clock::now() + get_fs_check_timeout(context()));
})}, }}},
m_single_command(single_command) m_single_command(single_command)
{} {}
@ -694,8 +694,8 @@ public:
: InputMode(input_handler), m_prompt(prompt.str()), m_prompt_face(face), : InputMode(input_handler), m_prompt(prompt.str()), m_prompt_face(face),
m_flags(flags), m_completer(std::move(completer)), m_callback(std::move(callback)), m_flags(flags), m_completer(std::move(completer)), m_callback(std::move(callback)),
m_autoshowcompl{context().options()["autoshowcompl"].get<bool>()}, m_autoshowcompl{context().options()["autoshowcompl"].get<bool>()},
m_idle_timer{TimePoint::max(), m_idle_timer{TimePoint::max(), context().flags() & Context::Flags::Transient ?
[this](Timer& timer) { Timer::Callback{} : [this](Timer&) {
if (m_autoshowcompl and m_refresh_completion_pending) if (m_autoshowcompl and m_refresh_completion_pending)
refresh_completions(CompletionFlags::Fast); refresh_completions(CompletionFlags::Fast);
if (m_line_changed) if (m_line_changed)
@ -1037,8 +1037,8 @@ public:
m_edition(context()), m_edition(context()),
m_completer(context()), m_completer(context()),
m_autoshowcompl(true), m_autoshowcompl(true),
m_idle_timer{TimePoint::max(), m_idle_timer{TimePoint::max(), context().flags() & Context::Flags::Transient ?
[this](Timer& timer) { Timer::Callback{} : [this](Timer&) {
if (m_autoshowcompl) if (m_autoshowcompl)
m_completer.update(); m_completer.update();
context().hooks().run_hook("InsertIdle", "", context()); context().hooks().run_hook("InsertIdle", "", context());