From 75eb293f986f5674041159c714e1fffbe773b04b Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 13 May 2018 17:59:01 +1000 Subject: [PATCH] Rename Context::Flags::Transient to Context::Flags::Draft Draft is well establish and all draft context are transient. --- src/buffer.cc | 2 +- src/commands.cc | 6 +++--- src/context.hh | 6 +++--- src/input_handler.cc | 20 ++++++++++---------- src/main.cc | 2 +- src/window.cc | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/buffer.cc b/src/buffer.cc index 79660c9b..d82b4627 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -695,7 +695,7 @@ void Buffer::run_hook_in_own_context(StringView hook_name, StringView param, Str return; InputHandler hook_handler{{ *this, Selection{} }, - Context::Flags::Transient, + Context::Flags::Draft, std::move(client_name)}; hooks().run_hook(hook_name, param, hook_handler.context()); } diff --git a/src/commands.cc b/src/commands.cc index 3c78ca04..ea90030e 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1581,7 +1581,7 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func) { auto context_wrap_for_buffer = [&](Buffer& buffer) { InputHandler input_handler{{ buffer, Selection{} }, - Context::Flags::Transient}; + Context::Flags::Draft}; Context& c = input_handler.context(); ScopedSetBool disable_hooks(c.hooks_disabled(), no_hooks); @@ -1621,7 +1621,7 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func) if (draft) { input_handler.emplace(base_context->selections(), - Context::Flags::Transient, + Context::Flags::Draft, base_context->name()); effective_context = &input_handler->context(); @@ -1675,7 +1675,7 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func) } else { - const bool transient = c.flags() & Context::Flags::Transient; + const bool transient = c.flags() & Context::Flags::Draft; auto original_jump_list = transient ? Optional{} : c.jump_list(); auto jump = transient ? Optional{} : c.selections(); diff --git a/src/context.hh b/src/context.hh index 11a9806b..f4562cf3 100644 --- a/src/context.hh +++ b/src/context.hh @@ -50,8 +50,8 @@ class Context public: enum class Flags { - None = 0, - Transient = 1, + None = 0, + Draft = 1, }; friend constexpr bool with_bit_ops(Meta::Type) { return true; } @@ -121,7 +121,7 @@ public: JumpList& jump_list() { return m_jump_list; } void push_jump(bool force = false) { - if (force or not (m_flags & Flags::Transient)) + if (force or not (m_flags & Flags::Draft)) m_jump_list.push(selections()); } diff --git a/src/input_handler.cc b/src/input_handler.cc index ff6e126f..f9710609 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -163,12 +163,12 @@ public: Normal(InputHandler& input_handler, bool single_command = false) : InputMode(input_handler), m_idle_timer{TimePoint::max(), - context().flags() & Context::Flags::Transient ? + context().flags() & Context::Flags::Draft ? Timer::Callback{} : [this](Timer&) { context().hooks().run_hook("NormalIdle", "", context()); }}, m_fs_check_timer{TimePoint::max(), - context().flags() & Context::Flags::Transient ? + context().flags() & Context::Flags::Draft ? Timer::Callback{} : Timer::Callback{[this](Timer& timer) { if (context().has_client()) context().client().check_if_buffer_needs_reloading(); @@ -179,7 +179,7 @@ public: void on_enabled() override { - if (not (context().flags() & Context::Flags::Transient)) + if (not (context().flags() & Context::Flags::Draft)) { if (context().has_client()) context().client().check_if_buffer_needs_reloading(); @@ -234,7 +234,7 @@ public: } }); - const bool transient = context().flags() & Context::Flags::Transient; + const bool transient = context().flags() & Context::Flags::Draft; auto cp = key.codepoint(); @@ -709,7 +709,7 @@ public: m_empty_text{std::move(emptystr)}, m_flags(flags), m_completer(std::move(completer)), m_callback(std::move(callback)), m_autoshowcompl{context().options()["autoshowcompl"].get()}, - m_idle_timer{TimePoint::max(), context().flags() & Context::Flags::Transient ? + m_idle_timer{TimePoint::max(), context().flags() & Context::Flags::Draft ? Timer::Callback{} : [this](Timer&) { if (m_autoshowcompl and m_refresh_completion_pending) refresh_completions(CompletionFlags::Fast); @@ -905,7 +905,7 @@ public: display(); m_line_changed = true; - if (enabled() and not (context().flags() & Context::Flags::Transient)) // The callback might have disabled us + if (enabled() and not (context().flags() & Context::Flags::Draft)) // The callback might have disabled us m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context())); } @@ -991,7 +991,7 @@ private: display(); m_line_changed = true; - if (not (context().flags() & Context::Flags::Transient)) + if (not (context().flags() & Context::Flags::Draft)) m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context())); } @@ -1076,7 +1076,7 @@ public: m_completer(context()), m_autoshowcompl{context().options()["autoshowcompl"].get()}, m_disable_hooks{context().hooks_disabled(), context().hooks_disabled()}, - m_idle_timer{TimePoint::max(), context().flags() & Context::Flags::Transient ? + m_idle_timer{TimePoint::max(), context().flags() & Context::Flags::Draft ? Timer::Callback{} : [this](Timer&) { if (m_autoshowcompl) m_completer.update(); @@ -1096,7 +1096,7 @@ public: void on_enabled() override { - if (not (context().flags() & Context::Flags::Transient)) + if (not (context().flags() & Context::Flags::Draft)) m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context())); } @@ -1124,7 +1124,7 @@ public: { auto& buffer = context().buffer(); - const bool transient = context().flags() & Context::Flags::Transient; + const bool transient = context().flags() & Context::Flags::Draft; bool update_completions = true; bool moved = false; if (m_mouse_handler.handle_key(key, context())) diff --git a/src/main.cc b/src/main.cc index d311164a..f05a950e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -748,7 +748,7 @@ int run_filter(StringView keystr, ConstArrayView files, bool quiet, { InputHandler input_handler{ { buffer, Selection{{0,0}, buffer.back_coord()} }, - Context::Flags::Transient + Context::Flags::Draft }; for (auto& key : keys) diff --git a/src/window.cc b/src/window.cc index 599850ed..a57e7426 100644 --- a/src/window.cc +++ b/src/window.cc @@ -333,7 +333,7 @@ void Window::run_hook_in_own_context(StringView hook_name, StringView param, return; InputHandler hook_handler{{ *m_buffer, Selection{} }, - Context::Flags::Transient, + Context::Flags::Draft, std::move(client_name)}; hook_handler.context().set_window(*this); if (m_client)