Skip to content

Commit c9edd6b

Browse files
committed
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.
1 parent 66e0014 commit c9edd6b

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/eval.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ eval_to_string(
520520
/*
521521
* Call eval_to_string() without using current local variables and using
522522
* textwinlock. When "use_sandbox" is TRUE use the sandbox.
523+
* Use legacy Vim script syntax.
523524
*/
524525
char_u *
525526
eval_to_string_safe(
@@ -528,7 +529,9 @@ eval_to_string_safe(
528529
{
529530
char_u *retval;
530531
funccal_entry_T funccal_entry;
532+
int save_sc_version = current_sctx.sc_version;
531533

534+
current_sctx.sc_version = 1;
532535
save_funccal(&funccal_entry);
533536
if (use_sandbox)
534537
++sandbox;
@@ -538,6 +541,7 @@ eval_to_string_safe(
538541
--sandbox;
539542
--textwinlock;
540543
restore_funccal();
544+
current_sctx.sc_version = save_sc_version;
541545
return retval;
542546
}
543547

src/testdir/test_vim9_script.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,20 @@ def Test_cexpr_vimscript()
10861086
set errorformat&
10871087
enddef
10881088

1089+
def Test_statusline_syntax()
1090+
# legacy syntax is used for 'statusline'
1091+
let lines =<< trim END
1092+
vim9script
1093+
func g:Status()
1094+
return '%{"x" is# "x"}'
1095+
endfunc
1096+
set laststatus=2 statusline=%!Status()
1097+
redrawstatus
1098+
set laststatus statusline=
1099+
END
1100+
CheckScriptSuccess(lines)
1101+
enddef
1102+
10891103
def Test_list_vimscript()
10901104
# checks line continuation and comments
10911105
let lines =<< trim END

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1437,
757759
/**/
758760
1436,
759761
/**/

0 commit comments

Comments
 (0)