To: vim_dev@googlegroups.com Subject: Patch 8.2.3836 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3836 Problem: Vim9: comment after expression not skipped to find NL. Solution: After evaluating an expression look for a newline after a # comment. Files: src/eval.c *** ../vim-8.2.3835/src/eval.c 2021-12-16 20:56:52.952098567 +0000 --- src/eval.c 2021-12-17 14:42:51.532808223 +0000 *************** *** 2222,2237 **** { int ret; char_u *p; int did_emsg_before = did_emsg; int called_emsg_before = called_emsg; int flags = evalarg == NULL ? 0 : evalarg->eval_flags; int end_error = FALSE; p = skipwhite(arg); ret = eval1(&p, rettv, evalarg); p = skipwhite(p); ! if (ret != FAIL) end_error = !ends_excmd2(arg, p); if (ret == FAIL || end_error) { --- 2222,2256 ---- { int ret; char_u *p; + char_u *expr_end; int did_emsg_before = did_emsg; int called_emsg_before = called_emsg; int flags = evalarg == NULL ? 0 : evalarg->eval_flags; + int check_for_end = TRUE; int end_error = FALSE; p = skipwhite(arg); ret = eval1(&p, rettv, evalarg); + expr_end = p; p = skipwhite(p); ! // In Vim9 script a command block is not split at NL characters for ! // commands using an expression argument. Skip over a '#' comment to check ! // for a following NL. Require white space before the '#'. ! if (in_vim9script() && p > expr_end) ! while (*p == '#') ! { ! char_u *nl = vim_strchr(p, NL); ! ! if (nl == NULL) ! break; ! p = skipwhite(nl + 1); ! if (eap != NULL && *p != NUL) ! eap->nextcmd = p; ! check_for_end = FALSE; ! } ! ! if (ret != FAIL && check_for_end) end_error = !ends_excmd2(arg, p); if (ret == FAIL || end_error) { *************** *** 2263,2269 **** return FAIL; } ! if (eap != NULL) set_nextcmd(eap, p); return ret; --- 2282,2288 ---- return FAIL; } ! if (check_for_end && eap != NULL) set_nextcmd(eap, p); return ret; *** ../vim-8.2.3835/src/version.c 2021-12-17 12:42:26.837710979 +0000 --- src/version.c 2021-12-17 14:27:16.534959876 +0000 *************** *** 751,752 **** --- 751,754 ---- { /* Add new patch number below this line */ + /**/ + 3836, /**/ -- hundred-and-one symptoms of being an internet addict: 53. To find out what time it is, you send yourself an e-mail and check the "Date:" field. /// 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 ///