diff options
author | Gary Johnson <garyjohn@spocom.com> | 2021-07-26 22:19:10 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-26 22:19:10 +0200 |
commit | 53ba05b09075f14227f9be831a22ed16f7cc26b2 (patch) | |
tree | 75d5ddb38aa9702416d73b7a7b8f158f1d0c320a /src/option.c | |
parent | 29b857150c111a455f1a38a8f748243524f692e1 (diff) | |
download | vim-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/option.c')
-rw-r--r-- | src/option.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/option.c b/src/option.c index 21d113e27..182ff341c 100644 --- a/src/option.c +++ b/src/option.c @@ -5181,6 +5181,10 @@ unset_global_local_option(char_u *name, void *from) set_chars_option((win_T *)from, &((win_T *)from)->w_p_lcs); redraw_later(NOT_VALID); break; + case PV_VE: + clear_string_option(&buf->b_p_ve); + buf->b_ve_flags = 0; + break; } } #endif @@ -5239,7 +5243,8 @@ get_varp_scope(struct vimoption *p, int opt_flags) #endif case PV_BKC: return (char_u *)&(curbuf->b_p_bkc); case PV_MENC: return (char_u *)&(curbuf->b_p_menc); - case PV_LCS: return (char_u *)&(curwin->w_p_lcs); + case PV_LCS: return (char_u *)&(curwin->w_p_lcs); + case PV_VE: return (char_u *)&(curbuf->b_p_ve); } return NULL; // "cannot happen" @@ -5507,6 +5512,8 @@ get_varp(struct vimoption *p) case PV_VSTS: return (char_u *)&(curbuf->b_p_vsts); case PV_VTS: return (char_u *)&(curbuf->b_p_vts); #endif + case PV_VE: return *curbuf->b_p_ve != NUL + ? (char_u *)&(curbuf->b_p_ve) : p->var; default: iemsg(_("E356: get_varp ERROR")); } // always return a valid pointer to avoid a crash! @@ -6084,6 +6091,8 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_lw = empty_option; #endif buf->b_p_menc = empty_option; + buf->b_p_ve = empty_option; + buf->b_ve_flags = 0; /* * Don't copy the options set by ex_help(), use the saved values, @@ -7026,6 +7035,16 @@ get_bkc_value(buf_T *buf) return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags; } +/* + * Get the local or global value of the 'virtualedit' flags. + */ + unsigned int +get_ve_flags(void) +{ + return (curbuf->b_ve_flags ? curbuf->b_ve_flags : ve_flags) + & ~(VE_NONE | VE_NONEU); +} + #if defined(FEAT_LINEBREAK) || defined(PROTO) /* * Get the local or global value of 'showbreak'. |