diff src/highlight.c @ 20116:513c62184ed8 v8.2.0613

patch 8.2.0613: Vim9: no check for space before #comment Commit: https://github.com/vim/vim/commit/1966c248814d5195edcd1208ed0e51e664a61283 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 20 22:42:32 2020 +0200 patch 8.2.0613: Vim9: no check for space before #comment Problem: Vim9: no check for space before #comment. Solution: Add space checks.
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 Apr 2020 22:45:04 +0200
parents 2c23053c654a
children 1acf700beb9c
line wrap: on
line diff
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -694,7 +694,7 @@ do_highlight(
     /*
      * ":highlight {group-name}": list highlighting for one group.
      */
-    if (!doclear && !dolink && ends_excmd(*linep))
+    if (!doclear && !dolink && ends_excmd2(line, linep))
     {
 	id = syn_namen2id(line, (int)(name_end - line));
 	if (id == 0)
@@ -720,14 +720,14 @@ do_highlight(
 	to_start = skipwhite(from_end);
 	to_end	 = skiptowhite(to_start);
 
-	if (ends_excmd(*from_start) || ends_excmd(*to_start))
+	if (ends_excmd2(line, from_start) || ends_excmd2(line, to_start))
 	{
 	    semsg(_("E412: Not enough arguments: \":highlight link %s\""),
 								  from_start);
 	    return;
 	}
 
-	if (!ends_excmd(*skipwhite(to_end)))
+	if (!ends_excmd2(line, skipwhite(to_end)))
 	{
 	    semsg(_("E413: Too many arguments: \":highlight link %s\""), from_start);
 	    return;
@@ -781,8 +781,7 @@ do_highlight(
 	/*
 	 * ":highlight clear [group]" command.
 	 */
-	line = linep;
-	if (ends_excmd(*line))
+	if (ends_excmd2(line, linep))
 	{
 #ifdef FEAT_GUI
 	    // First, we do not destroy the old values, but allocate the new
@@ -826,7 +825,7 @@ do_highlight(
 	    // It is now Ok to clear out the old data.
 #endif
 #ifdef FEAT_EVAL
-	    do_unlet((char_u *)"colors_name", TRUE);
+	    do_unlet((char_u *)"g:colors_name", TRUE);
 #endif
 	    restore_cterm_colors();
 
@@ -845,6 +844,7 @@ do_highlight(
 	    redraw_later_clear();
 	    return;
 	}
+	line = linep;
 	name_end = skiptowhite(line);
 	linep = skipwhite(name_end);
     }
@@ -888,7 +888,7 @@ do_highlight(
     }
 
     if (!doclear)
-      while (!ends_excmd(*linep))
+      while (!ends_excmd2(line, linep))
       {
 	key_start = linep;
 	if (*linep == '=')
@@ -4946,10 +4946,11 @@ ex_match(exarg_T *eap)
     if (!eap->skip)
 	match_delete(curwin, id, FALSE);
 
-    if (ends_excmd(*eap->arg))
+    if (ends_excmd2(eap->cmd, eap->arg))
 	end = eap->arg;
     else if ((STRNICMP(eap->arg, "none", 4) == 0
-		&& (VIM_ISWHITE(eap->arg[4]) || ends_excmd(eap->arg[4]))))
+		&& (VIM_ISWHITE(eap->arg[4])
+				      || ends_excmd2(eap->arg, eap->arg + 4))))
 	end = eap->arg + 4;
     else
     {
@@ -4967,7 +4968,7 @@ ex_match(exarg_T *eap)
 	end = skip_regexp(p + 1, *p, TRUE);
 	if (!eap->skip)
 	{
-	    if (*end != NUL && !ends_excmd(*skipwhite(end + 1)))
+	    if (*end != NUL && !ends_excmd2(end, skipwhite(end + 1)))
 	    {
 		vim_free(g);
 		eap->errmsg = e_trailing;