From efce8e0ce66edd1b29dbe91f1e2d5b2c219f1dd3 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 24 Feb 2018 19:58:40 +1100 Subject: [PATCH] Revert "Do not save last command/pipe/regex in register when history is disabled" This reverts commit 55621fb4cc9c01972317182dd6a8ed3ced0e1f9e. This should not be necessary as :exec/eval already save those registers and reset them by default, and it breaks the ability to use those registers during an eval/exec (as the commands behave differently) --- src/normal.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index bd07826c..5a631e76 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -449,7 +449,7 @@ void command(Context& context, NormalParams params) { if (cmdline.empty()) cmdline = context.main_sel_register_value(':'); - else if (not is_blank(cmdline[0]) and not context.history_disabled()) + else if (not is_blank(cmdline[0])) RegisterManager::instance()[':'].set(context, cmdline.str()); EnvVarMap env_vars = { @@ -509,7 +509,7 @@ void pipe(Context& context, NormalParams) if (cmdline.empty()) cmdline = context.main_sel_register_value("|"); - else if (not context.history_disabled()) + else RegisterManager::instance()['|'].set(context, cmdline.str()); if (cmdline.empty()) @@ -584,7 +584,7 @@ void insert_output(Context& context, NormalParams) if (cmdline.empty()) cmdline = context.main_sel_register_value("|"); - else if (not context.history_disabled()) + else RegisterManager::instance()['|'].set(context, cmdline.str()); if (cmdline.empty()) @@ -765,7 +765,8 @@ void search(Context& context, NormalParams params) const char reg = to_lower(params.reg ? params.reg : '/'); const int count = params.count; - auto saved_reg = RegisterManager::instance()[reg].get(context) | gather>(); + auto reg_content = RegisterManager::instance()[reg].get(context); + Vector saved_reg{reg_content.begin(), reg_content.end()}; const int main_index = std::min(context.selections().main_index(), saved_reg.size()-1); regex_prompt(context, prompt.str(), saved_reg[main_index], @@ -776,8 +777,7 @@ void search(Context& context, NormalParams params) RegisterManager::instance()[reg].set(context, saved_reg); return; } - if (not context.history_disabled()) - RegisterManager::instance()[reg].set(context, regex.str()); + RegisterManager::instance()[reg].set(context, regex.str()); if (regex.empty() or regex.str().empty()) return;