Skip to content

Commit ec1b096

Browse files
committed
patch 8.2.3405: cannot have a comment line in a {} block of a user command
Problem: Cannot have a comment line in a {} block of a user command. Solution: Continue after the line break. (closes #8837)
1 parent 01dd6c3 commit ec1b096

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/ex_docmd.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,7 +2807,16 @@ parse_command_modifiers(
28072807

28082808
// ignore comment and empty lines
28092809
if (comment_start(eap->cmd, starts_with_colon))
2810+
{
2811+
// a comment ends at a NL
2812+
if (eap->nextcmd == NULL)
2813+
{
2814+
eap->nextcmd = vim_strchr(eap->cmd, '\n');
2815+
if (eap->nextcmd != NULL)
2816+
++eap->nextcmd;
2817+
}
28102818
return FAIL;
2819+
}
28112820
if (*eap->cmd == NUL)
28122821
{
28132822
if (!skip_only)

src/testdir/test_usercommands.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,8 @@ endfunc
624624

625625
func Test_usercmd_with_block()
626626
command DoSomething {
627-
g:didit = 'yes'
627+
g:didit = 'yes' # comment
628+
# comment line
628629
g:didmore = 'more'
629630
}
630631
DoSomething

src/version.c

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

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3405,
758760
/**/
759761
3404,
760762
/**/

0 commit comments

Comments
 (0)