Mercurial > vim
changeset 21775:6922d78b4d52 v8.2.1437
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax
Commit: https://github.com/vim/vim/commit/c9edd6b58218d25bfc5389af901021dc0eb82578
Author: Bram Moolenaar <Bram@vim.org>
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 12 Aug 2020 22:30:07 +0200 |
parents | 05319227588e |
children | 2f8efe73cd7e |
files | src/eval.c src/testdir/test_vim9_script.vim src/version.c |
diffstat | 3 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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; }
--- 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