forked from aniani/vim
patch 9.1.0102: settabvar() may change the last accessed tabpage
Problem: settabvar() may change the last accessed tabpage. Solution: Save and restore lastused_tabpage. (zeertzjq) closes: #14017 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
bd1232a1fa
commit
b47fbb4083
@@ -4843,6 +4843,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
{
|
||||
tabpage_T *save_curtab;
|
||||
tabpage_T *tp;
|
||||
tabpage_T *save_lu_tp;
|
||||
char_u *varname, *tabvarname;
|
||||
typval_T *varp;
|
||||
|
||||
@@ -4862,6 +4863,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
return;
|
||||
|
||||
save_curtab = curtab;
|
||||
save_lu_tp = lastused_tabpage;
|
||||
goto_tabpage_tp(tp, FALSE, FALSE);
|
||||
|
||||
tabvarname = alloc(STRLEN(varname) + 3);
|
||||
@@ -4873,9 +4875,13 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
vim_free(tabvarname);
|
||||
}
|
||||
|
||||
// Restore current tabpage
|
||||
// Restore current tabpage and last accessed tabpage.
|
||||
if (valid_tabpage(save_curtab))
|
||||
{
|
||||
goto_tabpage_tp(save_curtab, FALSE, FALSE);
|
||||
if (valid_tabpage(save_lu_tp))
|
||||
lastused_tabpage = save_lu_tp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user