summaryrefslogtreecommitdiffstats
path: root/src/option.c
diff options
context:
space:
mode:
authorGary Johnson <garyjohn@spocom.com>2021-08-03 18:33:08 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-03 18:33:08 +0200
commit51ad850f5fbafa7aa3f60affa74ec9c9f992c6cc (patch)
tree18fd2f54ee199dcf739262d9df56ccb4d6ac53d1 /src/option.c
parent2c70711e3fb2ef24a7f55322fdadbf7f9e657c2f (diff)
patch 8.2.3280: 'virtualedit' local to buffer is not the best solutionv8.2.3280
Problem: 'virtualedit' local to buffer is not the best solution. Solution: Make it window-local. (Gary Johnson, closes #8685)
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/option.c b/src/option.c
index decba501a9..4e0e5a6ac6 100644
--- a/src/option.c
+++ b/src/option.c
@@ -5182,8 +5182,8 @@ unset_global_local_option(char_u *name, void *from)
redraw_later(NOT_VALID);
break;
case PV_VE:
- clear_string_option(&buf->b_p_ve);
- buf->b_ve_flags = 0;
+ clear_string_option(&((win_T *)from)->w_p_ve);
+ ((win_T *)from)->w_ve_flags = 0;
break;
}
}
@@ -5244,7 +5244,7 @@ get_varp_scope(struct vimoption *p, int opt_flags)
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_VE: return (char_u *)&(curbuf->b_p_ve);
+ case PV_VE: return (char_u *)&(curwin->w_p_ve);
}
return NULL; // "cannot happen"
@@ -5345,6 +5345,8 @@ get_varp(struct vimoption *p)
case PV_LIST: return (char_u *)&(curwin->w_p_list);
case PV_LCS: return *curwin->w_p_lcs != NUL
? (char_u *)&(curwin->w_p_lcs) : p->var;
+ case PV_VE: return *curwin->w_p_ve != NUL
+ ? (char_u *)&(curwin->w_p_ve) : p->var;
#ifdef FEAT_SPELL
case PV_SPELL: return (char_u *)&(curwin->w_p_spell);
#endif
@@ -5512,8 +5514,6 @@ 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!
@@ -5593,6 +5593,8 @@ copy_winopt(winopt_T *from, winopt_T *to)
to->wo_lcs = vim_strsave(from->wo_lcs);
to->wo_nu = from->wo_nu;
to->wo_rnu = from->wo_rnu;
+ to->wo_ve = vim_strsave(from->wo_ve);
+ to->wo_ve_flags = from->wo_ve_flags;
#ifdef FEAT_LINEBREAK
to->wo_nuw = from->wo_nuw;
#endif
@@ -5726,6 +5728,7 @@ check_winopt(winopt_T *wop UNUSED)
#endif
check_string_option(&wop->wo_wcr);
check_string_option(&wop->wo_lcs);
+ check_string_option(&wop->wo_ve);
}
/*
@@ -5772,6 +5775,7 @@ clear_winopt(winopt_T *wop UNUSED)
clear_string_option(&wop->wo_tws);
#endif
clear_string_option(&wop->wo_lcs);
+ clear_string_option(&wop->wo_ve);
}
#ifdef FEAT_EVAL
@@ -6091,8 +6095,6 @@ 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,
@@ -7041,8 +7043,8 @@ get_bkc_value(buf_T *buf)
unsigned int
get_ve_flags(void)
{
- return (curbuf->b_ve_flags ? curbuf->b_ve_flags : ve_flags)
- & ~(VE_NONE | VE_NONEU);
+ return (curwin->w_ve_flags ? curwin->w_ve_flags : ve_flags)
+ & ~(VE_NONE | VE_NONEU);
}
#if defined(FEAT_LINEBREAK) || defined(PROTO)