# HG changeset patch # User Bram Moolenaar # Date 1597940103 -7200 # Node ID f19ac9b8b0117ec95cb9d1add8da1f2f7649e16b # Parent 8e6e9c54e4f000b86d10c79ca2fe4033c702d190 patch 8.2.1496: Vim9: cannot use " #" in a mapping Commit: https://github.com/vim/vim/commit/b8a9296cedb9fae35572041ef5cfa894f3ad9fbb Author: Bram Moolenaar Date: Thu Aug 20 18:02:47 2020 +0200 patch 8.2.1496: Vim9: cannot use " #" in a mapping Problem: Vim9: cannot use " #" in a mapping. Solution: Do not remove a comment with the EX_NOTRLCOM flag. (closes https://github.com/vim/vim/issues/6746) diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4604,6 +4604,7 @@ separate_nextcmd(exarg_T *eap) #ifdef FEAT_EVAL || (*p == '#' && in_vim9script() + && !(eap->argt & EX_NOTRLCOM) && p[1] != '{' && p > eap->cmd && VIM_ISWHITE(p[-1])) #endif diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -286,5 +286,14 @@ def Test_eval_command() unlet g:val enddef +def Test_map_command() + let lines =<< trim END + nnoremap :echo 'hit F3 #' + assert_equal(":echo 'hit F3 #'", maparg("", "n")) + END + CheckDefSuccess(lines) + CheckScriptSuccess(['vim9script'] + lines) +enddef + " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1496, +/**/ 1495, /**/ 1494, diff --git a/src/vim9compile.c b/src/vim9compile.c --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -6251,6 +6251,7 @@ compile_exec(char_u *line, exarg_T *eap, usefilter = TRUE; if ((argt & EX_TRLBAR) && !usefilter) { + eap->argt = argt; separate_nextcmd(eap); if (eap->nextcmd != NULL) nextcmd = eap->nextcmd;