summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-20 18:02:47 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-20 18:02:47 +0200
commitb8a9296cedb9fae35572041ef5cfa894f3ad9fbb (patch)
tree4fc8dd365cd0a7f66a583e0d457b5e13a8252b72
parentdf2524bbb495c880d094d9542abf7c23d739cc53 (diff)
patch 8.2.1496: Vim9: cannot use " #" in a mappingv8.2.1496
Problem: Vim9: cannot use " #" in a mapping. Solution: Do not remove a comment with the EX_NOTRLCOM flag. (closes #6746)
-rw-r--r--src/ex_docmd.c1
-rw-r--r--src/testdir/test_vim9_cmd.vim9
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c1
4 files changed, 13 insertions, 0 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 233ac1041e..854ff4dfb0 100644
--- 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
index 676e97ceb1..9f4231a9a3 100644
--- 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
diff --git a/src/version.c b/src/version.c
index 126d98005c..c2057b318d 100644
--- 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
index 00572e3167..025e8cbc6e 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -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;