Problem: Vim9: 'statusline' is evaluated using Vim9 script syntax.
Solution: Always use legacy script syntax.
/*
* Call eval_to_string() without using current local variables and using
* textwinlock. When "use_sandbox" is TRUE use the sandbox.
+ * Use legacy Vim script syntax.
*/
char_u *
eval_to_string_safe(
{
char_u *retval;
funccal_entry_T funccal_entry;
+ int save_sc_version = current_sctx.sc_version;
+ current_sctx.sc_version = 1;
save_funccal(&funccal_entry);
if (use_sandbox)
++sandbox;
--sandbox;
--textwinlock;
restore_funccal();
+ current_sctx.sc_version = save_sc_version;
return retval;
}
set errorformat&
enddef
+def Test_statusline_syntax()
+ # legacy syntax is used for 'statusline'
+ let lines =<< trim END
+ vim9script
+ func g:Status()
+ return '%{"x" is# "x"}'
+ endfunc
+ set laststatus=2 statusline=%!Status()
+ redrawstatus
+ set laststatus statusline=
+ END
+ CheckScriptSuccess(lines)
+enddef
+
def Test_list_vimscript()
# checks line continuation and comments
let lines =<< trim END
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1437,
/**/
1436,
/**/