Do not preserve registers by default when exec/eval in a non draft context

Fixes #700
This commit is contained in:
Maxime Coste 2016-06-20 19:40:49 +01:00
parent 6e0279856f
commit fef37e6a92
2 changed files with 4 additions and 2 deletions

View File

@ -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<RegisterRestorer> 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();

View File

@ -33,7 +33,7 @@ main() {
set global autoshowcompl false
try %{ source rc }
try %{
exec '%s%\(\K[^)]+<ret><c-s>ld<a-t>(hHdi<c-u><esc><c-o>'
exec -save-regs '/' '%s%\(\K[^)]+<ret><c-s>ld<a-t>(hHdi<c-u><esc><c-o>'
} catch %{ exec gg }
hook global RuntimeError .+ %{
echo -debug -- error: %val{hook_param}