diff --git a/src/normal.cc b/src/normal.cc index fe129216..6208d01b 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -455,7 +455,7 @@ void command(Context& context, NormalParams params) { if (cmdline.empty()) cmdline = context.main_sel_register_value(':'); - else if (not is_blank(cmdline[0])) + else if (not is_blank(cmdline[0]) and not context.history_disabled()) RegisterManager::instance()[':'].set(context, cmdline.str()); EnvVarMap env_vars = { @@ -505,7 +505,7 @@ void pipe(Context& context, NormalParams) if (cmdline.empty()) cmdline = context.main_sel_register_value("|"); - else + else if (not context.history_disabled()) RegisterManager::instance()['|'].set(context, cmdline.str()); if (cmdline.empty()) @@ -580,7 +580,7 @@ void insert_output(Context& context, NormalParams) if (cmdline.empty()) cmdline = context.main_sel_register_value("|"); - else + else if (not context.history_disabled()) RegisterManager::instance()['|'].set(context, cmdline.str()); if (cmdline.empty()) @@ -761,8 +761,7 @@ void search(Context& context, NormalParams params) const char reg = to_lower(params.reg ? params.reg : '/'); const int count = params.count; - auto reg_content = RegisterManager::instance()[reg].get(context); - Vector saved_reg{reg_content.begin(), reg_content.end()}; + auto saved_reg = RegisterManager::instance()[reg].get(context) | gather>(); const int main_index = std::min(context.selections().main_index(), saved_reg.size()-1); regex_prompt(context, prompt.str(), saved_reg[main_index], @@ -773,7 +772,8 @@ void search(Context& context, NormalParams params) RegisterManager::instance()[reg].set(context, saved_reg); return; } - RegisterManager::instance()[reg].set(context, regex.str()); + if (not context.history_disabled()) + RegisterManager::instance()[reg].set(context, regex.str()); if (not regex.empty() and not regex.str().empty()) {