diff src/option.c @ 25174:b32c83317492 v8.2.3123

patch 8.2.3123: Vim9: confusing error when using white space after option Commit: https://github.com/vim/vim/commit/1594f313452cf6ca88375d9c8f68605a9c3c8ab5 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 8 16:40:13 2021 +0200 patch 8.2.3123: Vim9: confusing error when using white space after option Problem: Vim9: confusing error when using white space after option, before one of "!&<". Solution: Give a specific error. (issue #8408)
author Bram Moolenaar <Bram@vim.org>
date Thu, 08 Jul 2021 16:45:04 +0200
parents beff72446e2e
children af3d0198faad
line wrap: on
line diff
--- a/src/option.c
+++ b/src/option.c
@@ -1230,9 +1230,10 @@ ex_set(exarg_T *eap)
  */
     int
 do_set(
-    char_u	*arg,		// option string (may be written to!)
+    char_u	*arg_start,	// option string (may be written to!)
     int		opt_flags)
 {
+    char_u	*arg = arg_start;
     int		opt_idx;
     char	*errmsg;
     char	errbuf[80];
@@ -1387,7 +1388,11 @@ do_set(
 
 	    if (opt_idx == -1 && key == 0)	// found a mismatch: skip
 	    {
-		errmsg = N_("E518: Unknown option");
+		if (in_vim9script() && arg > arg_start
+				  && vim_strchr((char_u *)"!&<", *arg) != NULL)
+		    errmsg = e_no_white_space_allowed_between_option_and;
+		else
+		    errmsg = N_("E518: Unknown option");
 		goto skip;
 	    }