fix(api): win_set_config set tp_curwin of win moved from other tabpage

Problem: nvim_win_set_config does not update the tp_curwin of win's original
tabpage when moving it to another.

Solution: update it if win was the tp_curwin. Add a test.
This commit is contained in:
Sean Dewar
2024-03-09 16:56:32 +00:00
parent 33dfb5a383
commit b52d15853e
4 changed files with 78 additions and 19 deletions

View File

@ -3044,20 +3044,7 @@ static win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp)
xfree(frp);
} else {
*dirp = 'h'; // Dummy value.
if (tp == NULL) {
if (win_valid(prevwin) && prevwin != win) {
wp = prevwin;
} else {
wp = firstwin;
}
} else {
assert(tp != curtab);
if (tabpage_win_valid(tp, tp->tp_prevwin) && tp->tp_prevwin != win) {
wp = tp->tp_prevwin;
} else {
wp = tp->tp_firstwin;
}
}
wp = win_float_find_altwin(win, tp);
}
win_free(win, tp);