mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.4028: ml_get error with :doautoall and Visual area
Problem: ml_get error with :doautoall and Visual area. (Sean Dewar) Solution: Disable Visual mode while executing autocommands.
This commit is contained in:
@@ -1424,8 +1424,6 @@ ex_doautoall(exarg_T *eap)
|
||||
if (call_do_modelines && did_aucmd)
|
||||
do_modelines(0);
|
||||
}
|
||||
|
||||
check_cursor(); // just in case lines got deleted
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1532,6 +1530,10 @@ aucmd_prepbuf(
|
||||
curbuf = buf;
|
||||
aco->new_curwin_id = curwin->w_id;
|
||||
set_bufref(&aco->new_curbuf, curbuf);
|
||||
|
||||
// disable the Visual area, the position may be invalid in another buffer
|
||||
aco->save_VIsual_active = VIsual_active;
|
||||
VIsual_active = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1656,6 +1658,11 @@ win_found:
|
||||
check_cursor();
|
||||
}
|
||||
}
|
||||
|
||||
check_cursor(); // just in case lines got deleted
|
||||
VIsual_active = aco->save_VIsual_active;
|
||||
if (VIsual_active)
|
||||
check_pos(curbuf, &VIsual);
|
||||
}
|
||||
|
||||
static int autocmd_nested = FALSE;
|
||||
|
@@ -4031,6 +4031,7 @@ typedef struct
|
||||
int save_prevwin_id; // ID of saved prevwin
|
||||
bufref_T new_curbuf; // new curbuf
|
||||
char_u *globaldir; // saved value of globaldir
|
||||
int save_VIsual_active; // saved VIsual_active
|
||||
} aco_save_T;
|
||||
|
||||
/*
|
||||
|
@@ -2812,6 +2812,16 @@ func Test_close_autocmd_tab()
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_Visual_doautoall_redraw()
|
||||
call setline(1, ['a', 'b'])
|
||||
new
|
||||
wincmd p
|
||||
call feedkeys("G\<C-V>", 'txn')
|
||||
autocmd User Explode ++once redraw
|
||||
doautoall User Explode
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
" This was using freed memory.
|
||||
func Test_BufNew_arglocal()
|
||||
arglocal
|
||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4028,
|
||||
/**/
|
||||
4027,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user