Do not preserve registers by default when exec/eval in a non draft context
Fixes #700
This commit is contained in:
parent
6e0279856f
commit
fef37e6a92
|
@ -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_hooks = parser.get_switch("no-hooks") or context.user_hooks_disabled();
|
||||||
const bool no_keymaps = not parser.get_switch("with-maps");
|
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;
|
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);
|
saved_registers.emplace_back(r, context);
|
||||||
|
|
||||||
ClientManager& cm = ClientManager::instance();
|
ClientManager& cm = ClientManager::instance();
|
||||||
|
|
2
test/run
2
test/run
|
@ -33,7 +33,7 @@ main() {
|
||||||
set global autoshowcompl false
|
set global autoshowcompl false
|
||||||
try %{ source rc }
|
try %{ source rc }
|
||||||
try %{
|
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 }
|
} catch %{ exec gg }
|
||||||
hook global RuntimeError .+ %{
|
hook global RuntimeError .+ %{
|
||||||
echo -debug -- error: %val{hook_param}
|
echo -debug -- error: %val{hook_param}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user