aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/window.c
diff options
context:
space:
mode:
authorSean Dewar <6256228+seandewar@users.noreply.github.com>2024-03-12 23:05:09 +0000
committerGitHub <noreply@github.com>2024-03-12 23:05:09 +0000
commit9f59415243adcf70c02bc056ed755859456b20e8 (patch)
tree638f689b5225eb4e63c30b2cf15fb549e0780183 /src/nvim/eval/window.c
parentdc7ccd6bca81dfa6ade6462a6e30770c63d48266 (diff)
parentc048beef6c034a46e324fcea7210082d48db32ee (diff)
downloadrneovim-9f59415243adcf70c02bc056ed755859456b20e8.tar.gz
rneovim-9f59415243adcf70c02bc056ed755859456b20e8.tar.bz2
rneovim-9f59415243adcf70c02bc056ed755859456b20e8.zip
Merge pull request #27839 from seandewar/vim-9.1.0169
vim-patch:9.1.{0169,0170,0171,9a660d2883f9}
Diffstat (limited to 'src/nvim/eval/window.c')
-rw-r--r--src/nvim/eval/window.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c
index e54f46dcc3..3e2f6301ca 100644
--- a/src/nvim/eval/window.c
+++ b/src/nvim/eval/window.c
@@ -701,8 +701,8 @@ void f_win_splitmove(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
size = (int)tv_dict_get_number(d, "size");
}
- // Check if we can split the target before we bother switching windows.
- if (is_aucmd_win(wp) || text_or_buf_locked() || check_split_disallowed(targetwin) == FAIL) {
+ // Check if we're allowed to continue before we bother switching windows.
+ if (is_aucmd_win(wp) || text_or_buf_locked() || check_split_disallowed(wp) == FAIL) {
return;
}
@@ -956,13 +956,8 @@ int switch_win_noblock(switchwin_T *switchwin, win_T *win, tabpage_T *tp, bool n
if (tp != NULL) {
switchwin->sw_curtab = curtab;
if (no_display) {
- curtab->tp_firstwin = firstwin;
- curtab->tp_lastwin = lastwin;
- curtab->tp_topframe = topframe;
- curtab = tp;
- firstwin = curtab->tp_firstwin;
- lastwin = curtab->tp_lastwin;
- topframe = curtab->tp_topframe;
+ unuse_tabpage(curtab);
+ use_tabpage(tp);
} else {
goto_tabpage_tp(tp, false, false);
}
@@ -989,13 +984,12 @@ void restore_win_noblock(switchwin_T *switchwin, bool no_display)
{
if (switchwin->sw_curtab != NULL && valid_tabpage(switchwin->sw_curtab)) {
if (no_display) {
- curtab->tp_firstwin = firstwin;
- curtab->tp_lastwin = lastwin;
- curtab->tp_topframe = topframe;
- curtab = switchwin->sw_curtab;
- firstwin = curtab->tp_firstwin;
- lastwin = curtab->tp_lastwin;
- topframe = curtab->tp_topframe;
+ win_T *const old_tp_curwin = curtab->tp_curwin;
+
+ unuse_tabpage(curtab);
+ // Don't change the curwin of the tabpage we temporarily visited.
+ curtab->tp_curwin = old_tp_curwin;
+ use_tabpage(switchwin->sw_curtab);
} else {
goto_tabpage_tp(switchwin->sw_curtab, false, false);
}