patch 8.2.1518: Vim9: cannot assign to local option
Problem: Vim9: cannot assign to local option.
Solution: Skip over "&l:" and "&g:". (closes #6749)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index c0cea29..2c3dc70 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -4550,8 +4550,8 @@
p = var_start + 2;
else
{
- p = (*var_start == '&' || *var_start == '$')
- ? var_start + 1 : var_start;
+ // skip over the leading "&", "&l:", "&g:" and "$"
+ p = skip_option_env_lead(var_start);
p = to_name_end(p, TRUE);
}
@@ -4595,8 +4595,8 @@
}
cc = *p;
*p = NUL;
- opt_type = get_option_value(var_start + 1, &numval,
- NULL, opt_flags);
+ opt_type = get_option_value(skip_option_env_lead(var_start),
+ &numval, NULL, opt_flags);
*p = cc;
if (opt_type == -3)
{
@@ -5131,7 +5131,8 @@
switch (dest)
{
case dest_option:
- generate_STOREOPT(cctx, name + 1, opt_flags);
+ generate_STOREOPT(cctx, skip_option_env_lead(name),
+ opt_flags);
break;
case dest_global:
// include g: with the name, easier to execute that way