0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.3227: 'virtualedit' can only be set globally

Problem:    'virtualedit' can only be set globally.
Solution:   Make 'virtualedit' global-local. (Gary Johnson, closes #8638)
This commit is contained in:
Gary Johnson
2021-07-26 22:19:10 +02:00
committed by Bram Moolenaar
parent 29b857150c
commit 53ba05b090
17 changed files with 220 additions and 41 deletions

View File

@@ -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'.