From 4288f0fb3aad98ad26c85df89d9b84de1dad1132 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 1 May 2018 22:45:59 +1000 Subject: [PATCH] Move ScopedEdition to context_wrap No need to create it both in context_wrap and in the called function. --- src/commands.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index 978afbf4..a158b2c5 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1632,6 +1632,7 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func) ScopedSetBool disable_hooks(c.hooks_disabled(), no_hooks); ScopedSetBool disable_keymaps(c.keymaps_disabled(), no_keymaps); ScopedSetBool disable_history(c.history_disabled()); + ScopedEdition edition{c}; if (parser.get_switch("itersel")) { @@ -1639,7 +1640,6 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func) Vector new_sels; size_t main = 0; size_t timestamp = c.buffer().timestamp(); - ScopedEdition edition{c}; for (auto& sel : sels) { c.selections_write_only() = SelectionList{ sels.buffer(), sel, sels.timestamp() }; @@ -1700,7 +1700,6 @@ const CommandDesc exec_string_cmd = { keys.insert(keys.end(), param_keys.begin(), param_keys.end()); } - ScopedEdition edition(context); for (auto& key : keys) context.input_handler().handle_key(key); }); @@ -1718,9 +1717,7 @@ const CommandDesc eval_string_cmd = { [](const ParametersParser& parser, Context& context, const ShellContext& shell_context) { context_wrap(parser, context, [&](const ParametersParser& parser, Context& context) { - String command = join(parser, ' ', false); - ScopedEdition edition(context); - CommandManager::instance().execute(command, context, shell_context); + CommandManager::instance().execute(join(parser, ' ', false), context, shell_context); }); } };