diff --git a/src/commands.cc b/src/commands.cc index 8f552170..5070aa9a 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1395,8 +1395,10 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func) const bool no_hooks = parser.get_switch("no-hooks") or context.user_hooks_disabled(); const bool no_keymaps = not parser.get_switch("with-maps"); + const bool save_regs_by_default = (bool)parser.get_switch("draft") or + (bool)parser.get_switch("buffer"); Vector saved_registers; - for (auto& r : parser.get_switch("save-regs").value_or("/\"|^@")) + for (auto& r : parser.get_switch("save-regs").value_or(save_regs_by_default ? "/\"|^@" : "")) saved_registers.emplace_back(r, context); ClientManager& cm = ClientManager::instance(); diff --git a/test/run b/test/run index ab814956..77a6c911 100755 --- a/test/run +++ b/test/run @@ -33,7 +33,7 @@ main() { set global autoshowcompl false try %{ source rc } try %{ - exec '%s%\(\K[^)]+ld(hHdi' + exec -save-regs '/' '%s%\(\K[^)]+ld(hHdi' } catch %{ exec gg } hook global RuntimeError .+ %{ echo -debug -- error: %val{hook_param}