mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.5002: deletebufline() may change Visual selection
Problem: deletebufline() may change Visual selection. Solution: Disable Visual mode when using another buffer. (closes #10469)
This commit is contained in:
@@ -510,6 +510,7 @@ f_deletebufline(typval_T *argvars, typval_T *rettv)
|
|||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
int did_emsg_before = did_emsg;
|
int did_emsg_before = did_emsg;
|
||||||
|
int save_VIsual_active = VIsual_active;
|
||||||
|
|
||||||
rettv->vval.v_number = 1; // FAIL by default
|
rettv->vval.v_number = 1; // FAIL by default
|
||||||
|
|
||||||
@@ -538,6 +539,7 @@ f_deletebufline(typval_T *argvars, typval_T *rettv)
|
|||||||
|
|
||||||
if (!is_curbuf)
|
if (!is_curbuf)
|
||||||
{
|
{
|
||||||
|
VIsual_active = FALSE;
|
||||||
curbuf_save = curbuf;
|
curbuf_save = curbuf;
|
||||||
curwin_save = curwin;
|
curwin_save = curwin;
|
||||||
curbuf = buf;
|
curbuf = buf;
|
||||||
@@ -582,6 +584,7 @@ f_deletebufline(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
curbuf = curbuf_save;
|
curbuf = curbuf_save;
|
||||||
curwin = curwin_save;
|
curwin = curwin_save;
|
||||||
|
VIsual_active = save_VIsual_active;
|
||||||
}
|
}
|
||||||
rettv->vval.v_number = 0; // OK
|
rettv->vval.v_number = 0; // OK
|
||||||
}
|
}
|
||||||
|
@@ -238,4 +238,21 @@ func Test_setbufline_select_mode()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_deletebufline_select_mode()
|
||||||
|
new
|
||||||
|
call setline(1, ['foo', 'bar'])
|
||||||
|
call feedkeys("j^v2l\<C-G>", 'nx')
|
||||||
|
|
||||||
|
let bufnr = bufadd('Xdummy')
|
||||||
|
call bufload(bufnr)
|
||||||
|
call setbufline(bufnr, 1, ['abc', 'def'])
|
||||||
|
call deletebufline(bufnr, 1)
|
||||||
|
|
||||||
|
call feedkeys("x", 'nx')
|
||||||
|
call assert_equal(['foo', 'x'], getline(1, 2))
|
||||||
|
|
||||||
|
exe "bwipe! " .. bufnr
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -734,6 +734,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
5002,
|
||||||
/**/
|
/**/
|
||||||
5001,
|
5001,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user