]> granicus.if.org Git - vim/commitdiff
patch 8.2.1496: Vim9: cannot use " #" in a mapping v8.2.1496
authorBram Moolenaar <Bram@vim.org>
Thu, 20 Aug 2020 16:02:47 +0000 (18:02 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 20 Aug 2020 16:02:47 +0000 (18:02 +0200)
Problem:    Vim9: cannot use " #" in a mapping.
Solution:   Do not remove a comment with the EX_NOTRLCOM flag. (closes #6746)

src/ex_docmd.c
src/testdir/test_vim9_cmd.vim
src/version.c
src/vim9compile.c

index 233ac1041edc6d1465be363823f6fdbb2c99b0c3..854ff4dfb0a004a88d9c25579b7bbfc53374b48b 100644 (file)
@@ -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
index 676e97ceb1a4a08deb2a361c747e8ba0faad9045..9f4231a9a351b6cd140f56fff1883286b42e1cf5 100644 (file)
@@ -286,5 +286,14 @@ def Test_eval_command()
   unlet g:val
 enddef
 
+def Test_map_command()
+  let lines =<< trim END
+      nnoremap <F3> :echo 'hit F3 #'<CR>
+      assert_equal(":echo 'hit F3 #'<CR>", maparg("<F3>", "n"))
+  END
+  CheckDefSuccess(lines)
+  CheckScriptSuccess(['vim9script'] + lines)
+enddef
+
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
index 126d98005c61b2d08203f5cb5048c8b901c7b0ee..c2057b318d9040848b59d8e5a7dfda68d6aaeae5 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1496,
 /**/
     1495,
 /**/
index 00572e316763e93cd36d05c277d72e255de519a9..025e8cbc6e563ff2237b48962bda31e626c707fb 100644 (file)
@@ -6251,6 +6251,7 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
            usefilter = TRUE;
        if ((argt & EX_TRLBAR) && !usefilter)
        {
+           eap->argt = argt;
            separate_nextcmd(eap);
            if (eap->nextcmd != NULL)
                nextcmd = eap->nextcmd;