# HG changeset patch # User Bram Moolenaar # Date 1597264207 -7200 # Node ID 6922d78b4d521f2177f2bedaf1f3159843f75f9a # Parent 05319227588e3beee57b091e490a72e29d36fd55 patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax Commit: https://github.com/vim/vim/commit/c9edd6b58218d25bfc5389af901021dc0eb82578 Author: Bram Moolenaar Date: Wed Aug 12 22:18:23 2020 +0200 patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax Problem: Vim9: 'statusline' is evaluated using Vim9 script syntax. Solution: Always use legacy script syntax. diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -520,6 +520,7 @@ eval_to_string( /* * 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( @@ -528,7 +529,9 @@ 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; @@ -538,6 +541,7 @@ eval_to_string_safe( --sandbox; --textwinlock; restore_funccal(); + current_sctx.sc_version = save_sc_version; return retval; } diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -1086,6 +1086,20 @@ def Test_cexpr_vimscript() 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 diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1437, +/**/ 1436, /**/ 1435,