To: vim_dev@googlegroups.com Subject: Patch 8.2.3815 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3815 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. Files: src/ex_docmd.c, src/charset.c, src/proto/charset.pro, src/eval.c, src/testdir/test_vim9_expr.vim *** ../vim-8.2.3814/src/ex_docmd.c 2021-12-15 12:28:19.151133449 +0000 --- src/ex_docmd.c 2021-12-15 14:58:39.334362968 +0000 *************** *** 2305,2311 **** // versions. if (*p == '\\' && p[1] == '\n') STRMOVE(p, p + 1); ! else if (*p == '\n') { ea.nextcmd = p + 1; *p = NUL; --- 2305,2311 ---- // versions. if (*p == '\\' && p[1] == '\n') STRMOVE(p, p + 1); ! else if (*p == '\n' && (ea.argt & EX_TRLBAR)) { ea.nextcmd = p + 1; *p = NUL; *** ../vim-8.2.3814/src/charset.c 2021-11-29 12:12:38.175653429 +0000 --- src/charset.c 2021-12-15 14:48:07.831509389 +0000 *************** *** 1459,1472 **** } /* ! * skipwhite: skip over ' ' and '\t'. */ char_u * skipwhite(char_u *q) { char_u *p = q; ! while (VIM_ISWHITE(*p)) // skip to next non-white ++p; return p; } --- 1459,1485 ---- } /* ! * Skip over ' ' and '\t'. */ char_u * skipwhite(char_u *q) { char_u *p = q; ! 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; return p; } *** ../vim-8.2.3814/src/proto/charset.pro 2021-11-29 12:12:38.175653429 +0000 --- src/proto/charset.pro 2021-12-15 14:46:29.295696072 +0000 *************** *** 36,41 **** --- 36,42 ---- 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); char_u *skipwhite(char_u *q); + char_u *skipwhite_and_nl(char_u *q); int getwhitecols_curline(void); int getwhitecols(char_u *p); char_u *skipdigits(char_u *q); *** ../vim-8.2.3814/src/eval.c 2021-12-14 18:57:41.948194166 +0000 --- src/eval.c 2021-12-15 14:51:41.395113888 +0000 *************** *** 2150,2156 **** skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg) { int getnext; ! char_u *p = skipwhite(arg); if (evalarg == NULL) return skipwhite(arg); --- 2150,2156 ---- skipwhite_and_linebreak(char_u *arg, evalarg_T *evalarg) { int getnext; ! char_u *p = skipwhite_and_nl(arg); if (evalarg == NULL) return skipwhite(arg); *** ../vim-8.2.3814/src/testdir/test_vim9_expr.vim 2021-12-14 18:57:41.948194166 +0000 --- src/testdir/test_vim9_expr.vim 2021-12-15 14:57:44.802459783 +0000 *************** *** 2549,2554 **** --- 2549,2568 ---- CheckScriptSuccess(lines) 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() var lines =<< trim END vim9script *** ../vim-8.2.3814/src/version.c 2021-12-15 13:30:40.527268587 +0000 --- src/version.c 2021-12-15 14:52:35.175015855 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3815, /**/ -- Micro$oft: where do you want to go today? Linux: where do you want to go tomorrow? FreeBSD: are you guys coming, or what? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///