Validating an empty command in prompt reruns the last command

This is more consistent with other prompts like regexes or shells,
and has proven useful from time to time.
This commit is contained in:
Maxime Coste 2017-06-29 07:33:16 +01:00
parent 9bbab690ba
commit 14958a7c94

View File

@ -450,7 +450,11 @@ void command(Context& context, NormalParams params)
}
if (event == PromptEvent::Validate)
{
RegisterManager::instance()[':'].set(context, cmdline.str());
if (cmdline.empty())
cmdline = context.main_sel_register_value(':');
else
RegisterManager::instance()[':'].set(context, cmdline.str());
EnvVarMap env_vars = {
{ "count", to_string(params.count) },
{ "register", String{&params.reg, 1} }