To: vim_dev@googlegroups.com Subject: Patch 8.2.1129 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1129 Problem: Vim9: bar not recognized after not compiled command. Solution: Check for bar for commands where this is possible. (closes #6391) Files: src/vim9compile.c, src/testdir/test_vim9_cmd.vim *** ../vim-8.2.1128/src/vim9compile.c 2020-07-04 13:15:26.506990170 +0200 --- src/vim9compile.c 2020-07-05 14:55:34.232523384 +0200 *************** *** 6562,6573 **** { char_u *p; int has_expr = FALSE; if (cctx->ctx_skip == SKIP_YES) goto theend; if (eap->cmdidx >= 0 && eap->cmdidx < CMD_SIZE) ! has_expr = (excmd_get_argt(eap->cmdidx) & (EX_XFILE | EX_EXPAND)); if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0) { // expand filename in "syntax include [@group] filename" --- 6562,6594 ---- { char_u *p; int has_expr = FALSE; + char_u *nextcmd = (char_u *)""; if (cctx->ctx_skip == SKIP_YES) goto theend; if (eap->cmdidx >= 0 && eap->cmdidx < CMD_SIZE) ! { ! long argt = excmd_get_argt(eap->cmdidx); ! int usefilter = FALSE; ! ! has_expr = argt & (EX_XFILE | EX_EXPAND); ! ! // If the command can be followed by a bar, find the bar and truncate ! // it, so that the following command can be compiled. ! // The '|' is overwritten with a NUL, it is put back below. ! if ((eap->cmdidx == CMD_write || eap->cmdidx == CMD_read) ! && *eap->arg == '!') ! // :w !filter or :r !filter or :r! filter ! usefilter = TRUE; ! if ((argt & EX_TRLBAR) && !usefilter) ! { ! separate_nextcmd(eap); ! if (eap->nextcmd != NULL) ! nextcmd = eap->nextcmd; ! } ! } ! if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0) { // expand filename in "syntax include [@group] filename" *************** *** 6626,6632 **** generate_EXEC(cctx, line); theend: ! return (char_u *)""; } /* --- 6647,6660 ---- generate_EXEC(cctx, line); theend: ! if (*nextcmd != NUL) ! { ! // the parser expects a pointer to the bar, put it back ! --nextcmd; ! *nextcmd = '|'; ! } ! ! return nextcmd; } /* *** ../vim-8.2.1128/src/testdir/test_vim9_cmd.vim 2020-07-02 21:11:29.084843956 +0200 --- src/testdir/test_vim9_cmd.vim 2020-07-05 14:50:35.225674926 +0200 *************** *** 2,7 **** --- 2,8 ---- source check.vim source vim9.vim + source view_util.vim def Test_edit_wildcards() let filename = 'Xtest' *************** *** 207,211 **** --- 208,245 ---- CheckScriptSuccess(lines) enddef + def Test_bar_after_command() + def RedrawAndEcho() + let x = 'did redraw' + redraw | echo x + enddef + RedrawAndEcho() + assert_match('did redraw', Screenline(&lines)) + + if has('unix') + # bar in filter write command does not start new command + def WriteToShell() + new + setline(1, 'some text') + w !cat | cat > Xoutfile + bwipe! + enddef + WriteToShell() + assert_equal(['some text'], readfile('Xoutfile')) + delete('Xoutfile') + + # bar in filter read command does not start new command + def ReadFromShell() + new + r! echo hello there | cat > Xoutfile + r !echo again | cat >> Xoutfile + bwipe! + enddef + ReadFromShell() + assert_equal(['hello there', 'again'], readfile('Xoutfile')) + delete('Xoutfile') + endif + enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker *** ../vim-8.2.1128/src/version.c 2020-07-05 14:10:09.749447432 +0200 --- src/version.c 2020-07-05 14:20:29.019891556 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1129, /**/ -- It is too bad that the speed of light hasn't kept pace with the changes in CPU speed and network bandwidth. -- /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///