1
0
forked from aniani/vim

patch 8.2.1065: Vim9: no line break allowed inside a list

Problem:    Vim9: no line break allowed inside a list.
Solution:   Handle line break inside a list in Vim9 script.
This commit is contained in:
Bram Moolenaar
2020-06-26 22:46:27 +02:00
parent e6536aa766
commit 7147820cb9
8 changed files with 69 additions and 30 deletions

View File

@@ -1156,19 +1156,19 @@ f_join(typval_T *argvars, typval_T *rettv)
/*
* Allocate a variable for a List and fill it from "*arg".
* "*arg" points to the "[".
* Return OK or FAIL.
*/
int
get_list_tv(char_u **arg, typval_T *rettv, int flags, int do_error)
get_list_tv(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error)
{
int evaluate = flags & EVAL_EVALUATE;
int evaluate = evalarg == NULL ? FALSE
: evalarg->eval_flags & EVAL_EVALUATE;
int getnext;
list_T *l = NULL;
typval_T tv;
listitem_T *item;
evalarg_T evalarg;
CLEAR_FIELD(evalarg);
evalarg.eval_flags = flags;
int had_comma;
if (evaluate)
{
@@ -1178,9 +1178,12 @@ get_list_tv(char_u **arg, typval_T *rettv, int flags, int do_error)
}
*arg = skipwhite(*arg + 1);
eval_next_non_blank(*arg, evalarg, &getnext);
if (getnext)
*arg = eval_next_line(evalarg);
while (**arg != ']' && **arg != NUL)
{
if (eval1(arg, &tv, &evalarg) == FAIL) // recursive!
if (eval1(arg, &tv, evalarg) == FAIL) // recursive!
goto failret;
if (evaluate)
{
@@ -1195,15 +1198,24 @@ get_list_tv(char_u **arg, typval_T *rettv, int flags, int do_error)
clear_tv(&tv);
}
// the comma must comma after the value
had_comma = **arg == ',';
if (had_comma)
*arg = skipwhite(*arg + 1);
// the "]" can be on the next line
eval_next_non_blank(*arg, evalarg, &getnext);
if (getnext)
*arg = eval_next_line(evalarg);
if (**arg == ']')
break;
if (**arg != ',')
if (!had_comma)
{
if (do_error)
semsg(_("E696: Missing comma in List: %s"), *arg);
goto failret;
}
*arg = skipwhite(*arg + 1);
}
if (**arg != ']')