diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-06-06 21:38:09 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-06-06 21:38:09 +0200 |
commit | e729ce294f9756165020ad86e3b98b4112e1a6ab (patch) | |
tree | 9bfd11d59b2a6e1592dc7ee8dc8a7f4d943631ac /src/vim9compile.c | |
parent | 6db7b6375a3ea3afef5295b1366896902012e640 (diff) |
patch 8.2.2955: Vim9: using filter in compiled command does not workv8.2.2955
Problem: Vim9: using filter in compiled command does not work.
Solution: Generate EXEC including the command modifier.
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r-- | src/vim9compile.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c index 0c73433d5f..1256bfaac4 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -8536,13 +8536,30 @@ compile_put(char_u *arg, exarg_T *eap, cctx_T *cctx) static char_u * compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx) { - char_u *p; - int has_expr = FALSE; - char_u *nextcmd = (char_u *)""; + char_u *p; + int has_expr = FALSE; + char_u *nextcmd = (char_u *)""; if (cctx->ctx_skip == SKIP_YES) goto theend; + // If there was a prececing command modifier, drop it and include it in the + // EXEC command. + if (cctx->ctx_has_cmdmod) + { + garray_T *instr = &cctx->ctx_instr; + isn_T *isn = ((isn_T *)instr->ga_data) + instr->ga_len - 1; + + if (isn->isn_type == ISN_CMDMOD) + { + vim_regfree(isn->isn_arg.cmdmod.cf_cmdmod + ->cmod_filter_regmatch.regprog); + vim_free(isn->isn_arg.cmdmod.cf_cmdmod); + --instr->ga_len; + cctx->ctx_has_cmdmod = FALSE; + } + } + if (eap->cmdidx >= 0 && eap->cmdidx < CMD_SIZE) { long argt = eap->argt; |