Remove the exec_keys function

This commit is contained in:
Maxime Coste 2015-12-27 23:14:14 +00:00
parent 43f1fcf616
commit 11652ce230
3 changed files with 11 additions and 17 deletions

View File

@ -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<Key> keys, Context& context)
{
ScopedEdition edition(context);
for (auto& key : keys)
context.input_handler().handle_key(key);
}
void register_commands()
{
CommandManager& cm = CommandManager::instance();

View File

@ -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<Key> keys, Context& context);
struct kill_session {};

View File

@ -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<Direction direction>
@ -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");
}