mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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)
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1496,
|
||||
/**/
|
||||
1495,
|
||||
/**/
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user