aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshirasaka <shirasaka@n-create.co.jp>2020-12-04 12:03:04 +0900
committerShirasaka <tk.shirasaka@gmail.com>2020-12-05 20:18:51 +0900
commit9601e7c5d5cc455bd6649ece2049a528993f4c79 (patch)
treed73907195eb7f3833c4e69fbfabdea0556eba9ed
parentc348e816fc530f185d799270ad3c39bd0d6799a6 (diff)
downloadrneovim-9601e7c5d5cc455bd6649ece2049a528993f4c79.tar.gz
rneovim-9601e7c5d5cc455bd6649ece2049a528993f4c79.tar.bz2
rneovim-9601e7c5d5cc455bd6649ece2049a528993f4c79.zip
ui: Fix win_hide distination grid
When create tab, win_hide sent to new tab and new tab's previous tab. So, if created tab that not next tab (eg. $tabnew cmd), send win_hide to not current tab, and fixed this.
-rw-r--r--src/nvim/window.c5
-rw-r--r--test/functional/ui/multigrid_spec.lua71
2 files changed, 74 insertions, 2 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 72ee400e40..5a5d3690f6 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -3787,6 +3787,7 @@ 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 *old_curtab = curtab;
tabpage_T *tp = curtab;
tabpage_T *newtp;
int n;
@@ -3830,9 +3831,9 @@ int win_new_tabpage(int after, char_u *filename)
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);
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua
index 6601c2d68e..719e2ee82a 100644
--- a/test/functional/ui/multigrid_spec.lua
+++ b/test/functional/ui/multigrid_spec.lua
@@ -1562,6 +1562,77 @@ describe('ext_multigrid', function()
{1:~ }|
]]}
+ command('tabnext')
+ command('$tabnew')
+ screen:expect{grid=[[
+ ## grid 1
+ {16: }{17:2}{16: [No Name] }{17:2}{16: [No Name] }{7: [No Name] }{12: }{16:X}|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ [7:-----------------------------------------------------]|
+ {11:[No Name] }|
+ [3:-----------------------------------------------------]|
+ ## grid 2 (hidden)
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 3
+ |
+ ## grid 4 (hidden)
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 5 (hidden)
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 6 (hidden)
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ## grid 7
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ ]]}
+
+ command('tabclose')
command('tabclose')
screen:expect{grid=[[
## grid 1