Make empty context construction more explicit
This commit is contained in:
parent
f714766854
commit
ddd70fd09a
|
@ -9,7 +9,6 @@
|
|||
namespace Kakoune
|
||||
{
|
||||
|
||||
Context::Context() = default;
|
||||
Context::~Context() = default;
|
||||
|
||||
Context::Context(InputHandler& input_handler, SelectionList selections,
|
||||
|
@ -20,6 +19,8 @@ Context::Context(InputHandler& input_handler, SelectionList selections,
|
|||
m_name(std::move(name))
|
||||
{}
|
||||
|
||||
Context::Context(EmptyContextFlag) {}
|
||||
|
||||
Buffer& Context::buffer() const
|
||||
{
|
||||
if (not has_buffer())
|
||||
|
|
|
@ -63,9 +63,11 @@ public:
|
|||
Transient = 1,
|
||||
};
|
||||
|
||||
Context();
|
||||
Context(InputHandler& input_handler, SelectionList selections,
|
||||
Flags flags, String name = "");
|
||||
|
||||
struct EmptyContextFlag {};
|
||||
explicit Context(EmptyContextFlag);
|
||||
~Context();
|
||||
|
||||
Context(const Context&) = delete;
|
||||
|
|
|
@ -385,7 +385,7 @@ int run_server(StringView session, StringView init_command,
|
|||
|
||||
if (not ignore_kakrc) try
|
||||
{
|
||||
Context initialisation_context;
|
||||
Context initialisation_context{Context::EmptyContextFlag{}};
|
||||
command_manager.execute("source " + runtime_directory() + "/kakrc",
|
||||
initialisation_context);
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ int run_server(StringView session, StringView init_command,
|
|||
}
|
||||
|
||||
{
|
||||
Context empty_context;
|
||||
Context empty_context{Context::EmptyContextFlag{}};
|
||||
global_scope.hooks().run_hook("KakBegin", "", empty_context);
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ int run_server(StringView session, StringView init_command,
|
|||
}
|
||||
|
||||
{
|
||||
Context empty_context;
|
||||
Context empty_context{Context::EmptyContextFlag{}};
|
||||
global_scope.hooks().run_hook("KakEnd", "", empty_context);
|
||||
}
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ private:
|
|||
{
|
||||
if (not m_buffer.empty()) try
|
||||
{
|
||||
Context context{};
|
||||
Context context{Context::EmptyContextFlag{}};
|
||||
CommandManager::instance().execute(m_buffer, context);
|
||||
}
|
||||
catch (runtime_error& e)
|
||||
|
|
Loading…
Reference in New Issue
Block a user