patch 9.0.1876: Vim9: parsing commands with newlines wrong

Commit: 
https://github.com/vim/vim/commit/00cb247465856eaa546c520b65cf0ccc753ee1cd
Author: Christian Brabandt <[email protected]>
Date:   Tue Sep 5 20:46:25 2023 +0200

    patch 9.0.1876: Vim9: parsing commands with newlines wrong
    
    Problem:  Vim9: parsing commands with newlines wrong
    Solution: Accept a '
' for parsing lists and command arguments
    
    closes: #13015
    closes: #13020
    
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 10d979d49..d4b972a2e 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3954,7 +3954,7 @@ find_ex_command(
 #ifdef FEAT_EVAL
     if (eap->cmdidx < CMD_SIZE
            && vim9
-           && !IS_WHITE_OR_NUL(*p) && *p != '
' && *p != '!' && *p != '|'
+           && !IS_WHITE_NL_OR_NUL(*p) && *p != '!' && *p != '|'
            && (eap->cmdidx < 0 ||
                (cmdnames[eap->cmdidx].cmd_argt & EX_NONWHITE_OK) == 0))
     {
diff --git a/src/list.c b/src/list.c
index 6210fd638..d1494c67d 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1592,7 +1592,7 @@ eval_list(char_u **arg, typval_T *rettv, evalarg_T 
*evalarg, int do_error)
        had_comma = **arg == ',';
        if (had_comma)
        {
-           if (vim9script && !IS_WHITE_OR_NUL((*arg)[1]) && (*arg)[1] != ']')
+           if (vim9script && !IS_WHITE_NL_OR_NUL((*arg)[1]) && (*arg)[1] != 
']')
            {
                semsg(_(e_white_space_required_after_str_str), ",", *arg);
                goto failret;
diff --git a/src/macros.h b/src/macros.h
index b41a81827..d86097ced 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -43,6 +43,7 @@
  */
 #define VIM_ISWHITE(x)         ((x) == ' ' || (x) == ' ')
 #define IS_WHITE_OR_NUL(x)     ((x) == ' ' || (x) == ' ' || (x) == NUL)
+#define IS_WHITE_NL_OR_NUL(x)  ((x) == ' ' || (x) == ' ' || (x) == '
' || (x) == NUL)
 
 /*
  * LINEEMPTY() - return TRUE if the line is empty
diff --git a/src/testdir/test_crash.vim b/src/testdir/test_crash.vim
index f7b528c3e..aa3068429 100644
--- a/src/testdir/test_crash.vim
+++ b/src/testdir/test_crash.vim
@@ -62,7 +62,6 @@ func Test_crash1()
 
   let file = 'crash/vim_regsub_both_poc'
   let args = printf(cmn_args, vim, file)
-  " using || because this poc causes vim to exit with exitstatus != 0
   call term_sendkeys(buf, args ..
     \ '  && echo "crash 7: [OK]" >> X_crash1_result.txt' .. "\<cr>")
   call TermWait(buf, 1000)
diff --git a/src/testdir/test_usercommands.vim 
b/src/testdir/test_usercommands.vim
index 1e1856727..e161ee63f 100644
--- a/src/testdir/test_usercommands.vim
+++ b/src/testdir/test_usercommands.vim
@@ -772,6 +772,33 @@ func Test_usercmd_with_block()
   END
   call v9.CheckScriptFailure(lines, 'E1128:')
   delcommand BadCommand
+
+  let lines =<< trim END
+         vim9script
+    command Cmd {
+        g:result = [1,
+        2]
+    }
+    Cmd
+  END
+  call v9.CheckScriptSuccess(lines)
+  call assert_equal([1, 2], g:result)
+  delcommand Cmd
+       unlet! g:result
+
+  let lines =<< trim END
+               vim9script
+               command Cmd {
+                       g:result = and(0x80,
+                       0x80)
+    }
+    Cmd
+  END
+  call v9.CheckScriptSuccess(lines)
+  call assert_equal(128, g:result)
+  delcommand Cmd
+       unlet! g:result
+
 endfunc
 
 func Test_delcommand_buffer()
diff --git a/src/userfunc.c b/src/userfunc.c
index 0ebd61872..6638849db 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1879,7 +1879,7 @@ get_func_arguments(
            argp = skipwhite(argp);
        if (*argp != ',')
            break;
-       if (vim9script && !IS_WHITE_OR_NUL(argp[1]))
+       if (vim9script && !IS_WHITE_NL_OR_NUL(argp[1]))
        {
            if (evaluate)
                semsg(_(e_white_space_required_after_str_str), ",", argp);
diff --git a/src/version.c b/src/version.c
index f09039c64..db11876b3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -699,6 +699,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1876,
 /**/
     1875,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qdbHP-00GokN-Qc%40256bit.org.

Raspunde prin e-mail lui