patch 8.2.2222: Vim9: cannot keep script variables when reloading
Problem: Vim9: cannot keep script variables when reloading.
Solution: Add the "noclear" argument to :vim9script.
diff --git a/src/structs.h b/src/structs.h
index ea994f8..93a6b0a 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1821,7 +1821,7 @@
int sn_last_block_id; // Unique ID for each script block
int sn_version; // :scriptversion
- int sn_had_command; // TRUE if any command was executed
+ int sn_state; // SN_STATE_ values
char_u *sn_save_cpo; // 'cpo' value when :vim9script found
# ifdef FEAT_PROFILE
@@ -1845,6 +1845,10 @@
# endif
} scriptitem_T;
+#define SN_STATE_NEW 0 // newly loaded script, nothing done
+#define SN_STATE_RELOAD 1 // script loaded before, nothing done
+#define SN_STATE_HAD_COMMAND 9 // a command was executed
+
// Struct passed through eval() functions.
// See EVALARG_EVALUATE for a fixed value with eval_flags set to EVAL_EVALUATE.
typedef struct {