patch 8.2.2529: Vim9: Not possible to use legacy and Vim9 script in one file
Problem: Vim9: Not possible to use legacy and Vim9 script in one file.
Solution: Vim9: allow for "if false" before :vim9script. (closes #7851)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 77a7a71..371f3d6 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2595,8 +2595,12 @@
#ifdef FEAT_EVAL
// Set flag that any command was executed, used by ex_vim9script().
+ // Not if this was a command that wasn't executed or :endif.
if (getline_equal(ea.getline, ea.cookie, getsourceline)
- && current_sctx.sc_sid > 0)
+ && current_sctx.sc_sid > 0
+ && ea.cmdidx != CMD_endif
+ && (cstack->cs_idx < 0
+ || (cstack->cs_flags[cstack->cs_idx] & CSF_ACTIVE)))
SCRIPT_ITEM(current_sctx.sc_sid)->sn_state = SN_STATE_HAD_COMMAND;
/*