diff src/ex_docmd.c @ 25739:8c4dee4d1ac6 v8.2.3405

patch 8.2.3405: cannot have a comment line in a {} block of a user command Commit: https://github.com/vim/vim/commit/ec1b0968aa90d408a79b5b5dca465f65e69753a1 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 6 17:10:59 2021 +0200 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 https://github.com/vim/vim/issues/8837)
author Bram Moolenaar <Bram@vim.org>
date Mon, 06 Sep 2021 17:15:06 +0200
parents 812c75fd255c
children 589226a5f317
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2807,7 +2807,16 @@ parse_command_modifiers(
 
 	// ignore comment and empty lines
 	if (comment_start(eap->cmd, starts_with_colon))
+	{
+	    // a comment ends at a NL
+	    if (eap->nextcmd == NULL)
+	    {
+		eap->nextcmd = vim_strchr(eap->cmd, '\n');
+		if (eap->nextcmd != NULL)
+		    ++eap->nextcmd;
+	    }
 	    return FAIL;
+	}
 	if (*eap->cmd == NUL)
 	{
 	    if (!skip_only)