diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-12-05 21:22:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-05 21:22:19 +0100 |
commit | 463cf74182de8d11fb5d5c8448a205b10c2faca6 (patch) | |
tree | 28f9460b31f98c4803ca8484edbe169798cede70 /src | |
parent | 31787a91dcb1dc4b346129d22d0f44eb17a1f392 (diff) | |
parent | de0ecf3e031573d543857e92b42fc37bfaaa17a0 (diff) | |
download | rneovim-463cf74182de8d11fb5d5c8448a205b10c2faca6.tar.gz rneovim-463cf74182de8d11fb5d5c8448a205b10c2faca6.tar.bz2 rneovim-463cf74182de8d11fb5d5c8448a205b10c2faca6.zip |
Merge pull request #13454 from tk-shirasaka/fix/send-win_hide
ui: Fix win_hide distination grid
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/window.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 72ee400e40..9eb16e67ec 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -3787,32 +3787,35 @@ void free_tabpage(tabpage_T *tp) /// @return Was the new tabpage created successfully? FAIL or OK. int win_new_tabpage(int after, char_u *filename) { - tabpage_T *tp = curtab; + tabpage_T *old_curtab = curtab; tabpage_T *newtp; int n; newtp = alloc_tabpage(); - /* Remember the current windows in this Tab page. */ - if (leave_tabpage(curbuf, TRUE) == FAIL) { + // Remember the current windows in this Tab page. + if (leave_tabpage(curbuf, true) == FAIL) { xfree(newtp); return FAIL; } - newtp->tp_localdir = tp->tp_localdir ? vim_strsave(tp->tp_localdir) : NULL; + newtp->tp_localdir = old_curtab->tp_localdir + ? vim_strsave(old_curtab->tp_localdir) : NULL; curtab = newtp; - /* Create a new empty window. */ - if (win_alloc_firstwin(tp->tp_curwin) == OK) { - /* Make the new Tab page the new topframe. */ + // Create a new empty window. + if (win_alloc_firstwin(old_curtab->tp_curwin) == OK) { + // Make the new Tab page the new topframe. if (after == 1) { - /* New tab page becomes the first one. */ + // New tab page becomes the first one. newtp->tp_next = first_tabpage; first_tabpage = newtp; } else { + tabpage_T *tp = old_curtab; + if (after > 0) { - /* Put new tab page before tab page "after". */ + // Put new tab page before tab page "after". n = 2; for (tp = first_tabpage; tp->tp_next != NULL && n < after; tp = tp->tp_next) @@ -3826,13 +3829,13 @@ int win_new_tabpage(int after, char_u *filename) win_comp_scroll(curwin); newtp->tp_topframe = topframe; - last_status(FALSE); + last_status(false); redraw_all_later(NOT_VALID); - tabpage_check_windows(tp); + tabpage_check_windows(old_curtab); - lastused_tabpage = tp; + lastused_tabpage = old_curtab; apply_autocmds(EVENT_WINNEW, NULL, NULL, false, curbuf); apply_autocmds(EVENT_WINENTER, NULL, NULL, false, curbuf); @@ -3842,8 +3845,8 @@ int win_new_tabpage(int after, char_u *filename) return OK; } - /* Failed, get back the previous Tab page */ - enter_tabpage(curtab, curbuf, TRUE, TRUE); + // Failed, get back the previous Tab page + enter_tabpage(curtab, curbuf, true, true); return FAIL; } |