summaryrefslogtreecommitdiff
path: root/src/optionstr.c
diff options
context:
space:
mode:
authorGary Johnson <garyjohn@spocom.com>2021-07-26 22:19:10 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-26 22:19:10 +0200
commit53ba05b09075f14227f9be831a22ed16f7cc26b2 (patch)
tree75d5ddb38aa9702416d73b7a7b8f158f1d0c320a /src/optionstr.c
parent29b857150c111a455f1a38a8f748243524f692e1 (diff)
downloadvim-git-53ba05b09075f14227f9be831a22ed16f7cc26b2.tar.gz
patch 8.2.3227: 'virtualedit' can only be set globallyv8.2.3227
Problem: 'virtualedit' can only be set globally. Solution: Make 'virtualedit' global-local. (Gary Johnson, closes #8638)
Diffstat (limited to 'src/optionstr.c')
-rw-r--r--src/optionstr.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/optionstr.c b/src/optionstr.c
index 4c1cacc5c..c22a441ff 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -56,7 +56,7 @@ static char *(p_tbis_values[]) = {"tiny", "small", "medium", "large", "huge", "g
#if defined(UNIX) || defined(VMS)
static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", "sgr", NULL};
#endif
-static char *(p_ve_values[]) = {"block", "insert", "all", "onemore", NULL};
+static char *(p_ve_values[]) = {"block", "insert", "all", "onemore", "none", "NONE", NULL};
static char *(p_wop_values[]) = {"tagfile", NULL};
#ifdef FEAT_WAK
static char *(p_wak_values[]) = {"yes", "menu", "no", NULL};
@@ -298,6 +298,7 @@ check_buf_options(buf_T *buf)
check_string_option(&buf->b_p_vsts);
check_string_option(&buf->b_p_vts);
#endif
+ check_string_option(&buf->b_p_ve);
}
/*
@@ -2075,16 +2076,31 @@ ambw_end:
#endif
// 'virtualedit'
- else if (varp == &p_ve)
+ else if (gvarp == &p_ve)
{
- if (opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE) != OK)
- errmsg = e_invarg;
- else if (STRCMP(p_ve, oldval) != 0)
+ char_u *ve = p_ve;
+ unsigned int *flags = &ve_flags;
+
+ if (opt_flags & OPT_LOCAL)
+ {
+ ve = curbuf->b_p_ve;
+ flags = &curbuf->b_ve_flags;
+ }
+
+ if ((opt_flags & OPT_LOCAL) && *ve == NUL)
+ // make the local value empty: use the global value
+ *flags = 0;
+ else
{
- // Recompute cursor position in case the new 've' setting
- // changes something.
- validate_virtcol();
- coladvance(curwin->w_virtcol);
+ if (opt_strings_flags(ve, p_ve_values, flags, TRUE) != OK)
+ errmsg = e_invarg;
+ else if (STRCMP(p_ve, oldval) != 0)
+ {
+ // Recompute cursor position in case the new 've' setting
+ // changes something.
+ validate_virtcol();
+ coladvance(curwin->w_virtcol);
+ }
}
}