mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3815: Vim9: cannot have a multi-line dict inside a block
Problem: Vim9: cannot have a multi-line dict inside a block. Solution: Do not split the command at a line break, handle NL characters as white space.
This commit is contained in:
parent
cfabad9bcf
commit
ce7eada12e
@ -1459,14 +1459,27 @@ getvcols(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* skipwhite: skip over ' ' and '\t'.
|
* Skip over ' ' and '\t'.
|
||||||
*/
|
*/
|
||||||
char_u *
|
char_u *
|
||||||
skipwhite(char_u *q)
|
skipwhite(char_u *q)
|
||||||
{
|
{
|
||||||
char_u *p = q;
|
char_u *p = q;
|
||||||
|
|
||||||
while (VIM_ISWHITE(*p)) // skip to next non-white
|
while (VIM_ISWHITE(*p))
|
||||||
|
++p;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* skip over ' ', '\t' and '\n'.
|
||||||
|
*/
|
||||||
|
char_u *
|
||||||
|
skipwhite_and_nl(char_u *q)
|
||||||
|
{
|
||||||
|
char_u *p = q;
|
||||||
|
|
||||||
|
while (VIM_ISWHITE(*p) || *p == NL)
|
||||||
++p;
|
++p;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -2150,7 +2150,7 @@ eval_next_line(evalarg_T *evalarg)
|
|||||||
skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg)
|
skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg)
|
||||||
{
|
{
|
||||||
int getnext;
|
int getnext;
|
||||||
char_u *p = skipwhite(arg);
|
char_u *p = skipwhite_and_nl(arg);
|
||||||
|
|
||||||
if (evalarg == NULL)
|
if (evalarg == NULL)
|
||||||
return skipwhite(arg);
|
return skipwhite(arg);
|
||||||
|
@ -2305,7 +2305,7 @@ do_one_cmd(
|
|||||||
// versions.
|
// versions.
|
||||||
if (*p == '\\' && p[1] == '\n')
|
if (*p == '\\' && p[1] == '\n')
|
||||||
STRMOVE(p, p + 1);
|
STRMOVE(p, p + 1);
|
||||||
else if (*p == '\n')
|
else if (*p == '\n' && (ea.argt & EX_TRLBAR))
|
||||||
{
|
{
|
||||||
ea.nextcmd = p + 1;
|
ea.nextcmd = p + 1;
|
||||||
*p = NUL;
|
*p = NUL;
|
||||||
|
@ -36,6 +36,7 @@ colnr_T getvcol_nolist(pos_T *posp);
|
|||||||
void getvvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end);
|
void getvvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end);
|
||||||
void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right);
|
void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right);
|
||||||
char_u *skipwhite(char_u *q);
|
char_u *skipwhite(char_u *q);
|
||||||
|
char_u *skipwhite_and_nl(char_u *q);
|
||||||
int getwhitecols_curline(void);
|
int getwhitecols_curline(void);
|
||||||
int getwhitecols(char_u *p);
|
int getwhitecols(char_u *p);
|
||||||
char_u *skipdigits(char_u *q);
|
char_u *skipdigits(char_u *q);
|
||||||
|
@ -2549,6 +2549,20 @@ def Test_expr7_dict_vim9script()
|
|||||||
CheckScriptSuccess(lines)
|
CheckScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
def Test_expr7_dict_in_block()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
command MyCommand {
|
||||||
|
echo {
|
||||||
|
k: 0, }
|
||||||
|
}
|
||||||
|
MyCommand
|
||||||
|
END
|
||||||
|
CheckScriptSuccess(lines)
|
||||||
|
|
||||||
|
delcommand MyCommand
|
||||||
|
enddef
|
||||||
|
|
||||||
def Test_expr7_call_2bool()
|
def Test_expr7_call_2bool()
|
||||||
var lines =<< trim END
|
var lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
@ -749,6 +749,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3815,
|
||||||
/**/
|
/**/
|
||||||
3814,
|
3814,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user