mirror of
https://github.com/vim/vim.git
synced 2025-10-01 04:54:07 -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:
committed by
Bram Moolenaar
parent
29b857150c
commit
53ba05b090
21
src/misc2.c
21
src/misc2.c
@@ -22,14 +22,16 @@ static int coladvance2(pos_T *pos, int addspaces, int finetune, colnr_T wcol);
|
||||
int
|
||||
virtual_active(void)
|
||||
{
|
||||
unsigned int cur_ve_flags = get_ve_flags();
|
||||
|
||||
// While an operator is being executed we return "virtual_op", because
|
||||
// VIsual_active has already been reset, thus we can't check for "block"
|
||||
// being used.
|
||||
if (virtual_op != MAYBE)
|
||||
return virtual_op;
|
||||
return (ve_flags == VE_ALL
|
||||
|| ((ve_flags & VE_BLOCK) && VIsual_active && VIsual_mode == Ctrl_V)
|
||||
|| ((ve_flags & VE_INSERT) && (State & INSERT)));
|
||||
return (cur_ve_flags == VE_ALL
|
||||
|| ((cur_ve_flags & VE_BLOCK) && VIsual_active && VIsual_mode == Ctrl_V)
|
||||
|| ((cur_ve_flags & VE_INSERT) && (State & INSERT)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -137,7 +139,7 @@ coladvance2(
|
||||
one_more = (State & INSERT)
|
||||
|| restart_edit != NUL
|
||||
|| (VIsual_active && *p_sel != 'o')
|
||||
|| ((ve_flags & VE_ONEMORE) && wcol < MAXCOL);
|
||||
|| ((get_ve_flags() & VE_ONEMORE) && wcol < MAXCOL);
|
||||
line = ml_get_buf(curbuf, pos->lnum, FALSE);
|
||||
|
||||
if (wcol >= MAXCOL)
|
||||
@@ -549,9 +551,10 @@ check_cursor_col(void)
|
||||
void
|
||||
check_cursor_col_win(win_T *win)
|
||||
{
|
||||
colnr_T len;
|
||||
colnr_T oldcol = win->w_cursor.col;
|
||||
colnr_T oldcoladd = win->w_cursor.col + win->w_cursor.coladd;
|
||||
colnr_T len;
|
||||
colnr_T oldcol = win->w_cursor.col;
|
||||
colnr_T oldcoladd = win->w_cursor.col + win->w_cursor.coladd;
|
||||
unsigned int cur_ve_flags = get_ve_flags();
|
||||
|
||||
len = (colnr_T)STRLEN(ml_get_buf(win->w_buffer, win->w_cursor.lnum, FALSE));
|
||||
if (len == 0)
|
||||
@@ -564,7 +567,7 @@ check_cursor_col_win(win_T *win)
|
||||
// - 'virtualedit' is set
|
||||
if ((State & INSERT) || restart_edit
|
||||
|| (VIsual_active && *p_sel != 'o')
|
||||
|| (ve_flags & VE_ONEMORE)
|
||||
|| (cur_ve_flags & VE_ONEMORE)
|
||||
|| virtual_active())
|
||||
win->w_cursor.col = len;
|
||||
else
|
||||
@@ -583,7 +586,7 @@ check_cursor_col_win(win_T *win)
|
||||
// line.
|
||||
if (oldcol == MAXCOL)
|
||||
win->w_cursor.coladd = 0;
|
||||
else if (ve_flags == VE_ALL)
|
||||
else if (cur_ve_flags == VE_ALL)
|
||||
{
|
||||
if (oldcoladd > win->w_cursor.col)
|
||||
{
|
||||
|
Reference in New Issue
Block a user