Skip to content

Commit b8a9296

Browse files
committed
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 #6746)
1 parent df2524b commit b8a9296

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/ex_docmd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4604,6 +4604,7 @@ separate_nextcmd(exarg_T *eap)
46044604
#ifdef FEAT_EVAL
46054605
|| (*p == '#'
46064606
&& in_vim9script()
4607+
&& !(eap->argt & EX_NOTRLCOM)
46074608
&& p[1] != '{'
46084609
&& p > eap->cmd && VIM_ISWHITE(p[-1]))
46094610
#endif

src/testdir/test_vim9_cmd.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,5 +286,14 @@ def Test_eval_command()
286286
unlet g:val
287287
enddef
288288

289+
def Test_map_command()
290+
let lines =<< trim END
291+
nnoremap <F3> :echo 'hit F3 #'<CR>
292+
assert_equal(":echo 'hit F3 #'<CR>", maparg("<F3>", "n"))
293+
END
294+
CheckDefSuccess(lines)
295+
CheckScriptSuccess(['vim9script'] + lines)
296+
enddef
297+
289298

290299
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1496,
757759
/**/
758760
1495,
759761
/**/

src/vim9compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6251,6 +6251,7 @@ compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx)
62516251
usefilter = TRUE;
62526252
if ((argt & EX_TRLBAR) && !usefilter)
62536253
{
6254+
eap->argt = argt;
62546255
separate_nextcmd(eap);
62556256
if (eap->nextcmd != NULL)
62566257
nextcmd = eap->nextcmd;

0 commit comments

Comments
 (0)