changeset 21893:f19ac9b8b011 v8.2.1496

patch 8.2.1496: Vim9: cannot use " #" in a mapping Commit: https://github.com/vim/vim/commit/b8a9296cedb9fae35572041ef5cfa894f3ad9fbb Author: Bram Moolenaar <Bram@vim.org> 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)
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Aug 2020 18:15:03 +0200
parents 8e6e9c54e4f0
children 0a3a52ec5f4c
files src/ex_docmd.c src/testdir/test_vim9_cmd.vim src/version.c src/vim9compile.c
diffstat 4 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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 <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
--- 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,
--- 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;