patch 8.2.4357: sticky command modifiers are too sticky
Problem: sticky command modifiers are too sticky.
Solution: Do not apply command modifiers to a sourced script. (closes #9751)
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 3b9fec1..2606737 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -1254,6 +1254,7 @@
#ifdef FEAT_PROFILE
proftime_T wait_start;
#endif
+ int save_sticky_cmdmod_flags = sticky_cmdmod_flags;
int trigger_source_post = FALSE;
ESTACK_CHECK_DECLARATION
@@ -1394,6 +1395,9 @@
time_push(&tv_rel, &tv_start);
#endif
+ // "legacy" does not apply to commands in the script
+ sticky_cmdmod_flags = 0;
+
save_current_sctx = current_sctx;
current_sctx.sc_version = 1; // default script version
@@ -1618,6 +1622,7 @@
theend:
vim_free(fname_exp);
+ sticky_cmdmod_flags = save_sticky_cmdmod_flags;
#ifdef FEAT_EVAL
estack_compiling = save_estack_compiling;
#endif