diff src/ex_eval.c @ 26228:269ecc6d69bc v8.2.3645

patch 8.2.3645: Vim9: The "no effect" error is not given for all registers Commit: https://github.com/vim/vim/commit/7d5b8becc342e49e491053ea842e59f82d072001 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 22 15:05:46 2021 +0000 patch 8.2.3645: Vim9: The "no effect" error is not given for all registers Problem: Vim9: The "no effect" error is not given for all registers. Solution: Include any character following '@'. (closes https://github.com/vim/vim/issues/8779)
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Nov 2021 16:15:04 +0100
parents 1c567eb92222
children 9e6ddd7b91cd
line wrap: on
line diff
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -887,22 +887,32 @@ report_discard_pending(int pending, void
     }
 }
 
+/*
+ * Return TRUE if "arg" is only a variable, register or option name.
+ */
     int
 cmd_is_name_only(char_u *arg)
 {
     char_u  *p = arg;
-    char_u  *alias;
+    char_u  *alias = NULL;
     int	    name_only = FALSE;
 
-    if (*p == '&')
+    if (*p == '@')
     {
 	++p;
-	if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
-	    p += 2;
+	if (*p != NUL)
+	    ++p;
     }
-    else if (*p == '@')
-	++p;
-    get_name_len(&p, &alias, FALSE, FALSE);
+    else
+    {
+	if (*p == '&')
+	{
+	    ++p;
+	    if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
+		p += 2;
+	}
+	get_name_len(&p, &alias, FALSE, FALSE);
+    }
     name_only = ends_excmd2(arg, skipwhite(p));
     vim_free(alias);
     return name_only;