From 11652ce2301632f9bef5af32e119ec15c8540865 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 27 Dec 2015 23:14:14 +0000 Subject: [PATCH] Remove the exec_keys function --- src/commands.cc | 13 ++++--------- src/commands.hh | 6 ------ src/normal.cc | 9 +++++++-- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index f6ea2f78..3705d77b 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1394,7 +1394,10 @@ const CommandDesc exec_string_cmd = { KeyList param_keys = parse_keys(param); keys.insert(keys.end(), param_keys.begin(), param_keys.end()); } - exec_keys(keys, context); + + ScopedEdition edition(context); + for (auto& key : keys) + context.input_handler().handle_key(key); }); } }; @@ -1732,14 +1735,6 @@ const CommandDesc change_working_directory_cmd = { } -void exec_keys(ConstArrayView keys, Context& context) -{ - ScopedEdition edition(context); - - for (auto& key : keys) - context.input_handler().handle_key(key); -} - void register_commands() { CommandManager& cm = CommandManager::instance(); diff --git a/src/commands.hh b/src/commands.hh index 1e70bd1e..1ecdef2a 100644 --- a/src/commands.hh +++ b/src/commands.hh @@ -1,16 +1,10 @@ #ifndef commands_hh_INCLUDED #define commands_hh_INCLUDED -#include "array_view.hh" - namespace Kakoune { -class Context; -struct Key; - void register_commands(); -void exec_keys(ConstArrayView keys, Context& context); struct kill_session {}; diff --git a/src/normal.cc b/src/normal.cc index 54e7a558..7154f409 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1129,7 +1129,11 @@ void replay_macro(Context& context, NormalParams params) auto keys = parse_keys(reg_val[0]); ScopedEdition edition(context); - do { exec_keys(keys, context); } while (--params.count > 0); + do + { + for (auto& key : keys) + context.input_handler().handle_key(key); + } while (--params.count > 0); } template @@ -1411,7 +1415,8 @@ void exec_user_mappings(Context& context, NormalParams params) auto mapping = context.keymaps().get_mapping(key, KeymapMode::User); ScopedEdition edition(context); - exec_keys(mapping, context); + for (auto& key : mapping) + context.input_handler().handle_key(key); }, "user mapping", "enter user key"); }