]> granicus.if.org Git - vim/commitdiff
patch 8.2.1437: Vim9: 'statusline' is evaluated using Vim9 script syntax v8.2.1437
authorBram Moolenaar <Bram@vim.org>
Wed, 12 Aug 2020 20:18:23 +0000 (22:18 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 12 Aug 2020 20:18:23 +0000 (22:18 +0200)
Problem:    Vim9: 'statusline' is evaluated using Vim9 script syntax.
Solution:   Always use legacy script syntax.

src/eval.c
src/testdir/test_vim9_script.vim
src/version.c

index 07b30c723a996059bb26725849270ae196ce1b51..984835b6da9bab9f1b3c0c4c17e48ceae6a34066 100644 (file)
@@ -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;
 }
 
index 8742883e16952e8dac4f18dca7a2df900dbe8c3e..b462e473d98fba16455039d39a016eaba28f7c0f 100644 (file)
@@ -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
index d4b0afa7beb869fd221ba1593e1530798ff4cef4..7fcd9cbe8e7cda7973db5fb38ff2af5605d6919c 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1437,
 /**/
     1436,
 /**/