aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWe're Yet <58348703+butwerenotthereyet@users.noreply.github.com>2020-01-18 13:19:56 -0800
committerWe're Yet <58348703+butwerenotthereyet@users.noreply.github.com>2020-01-19 14:30:12 -0800
commit8e385eb46a8b961a760e05b4cfa053cf713def62 (patch)
treeafc903922f87db3f8b4d05408651d651c690da95
parentfd89ad7bfb1534c42c99b36ca025ea42ccbee7e1 (diff)
downloadrneovim-8e385eb46a8b961a760e05b4cfa053cf713def62.tar.gz
rneovim-8e385eb46a8b961a760e05b4cfa053cf713def62.tar.bz2
rneovim-8e385eb46a8b961a760e05b4cfa053cf713def62.zip
tabpage: :tabs indicates previous tabpage's curwin
-rw-r--r--src/nvim/ex_docmd.c6
-rw-r--r--src/nvim/testdir/test_startup.vim4
-rw-r--r--src/nvim/testdir/test_tabpage.vim2
-rw-r--r--test/functional/autocmd/tabnewentered_spec.lua45
4 files changed, 45 insertions, 12 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 30e7ecd434..6bda62594e 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -7037,6 +7037,10 @@ static void ex_tabs(exarg_T *eap)
msg_start();
msg_scroll = TRUE;
+ win_T *lastused_win = valid_tabpage(lastused_tabpage)
+ ? lastused_tabpage->tp_curwin
+ : NULL;
+
FOR_ALL_TABS(tp) {
if (got_int) {
break;
@@ -7054,7 +7058,7 @@ static void ex_tabs(exarg_T *eap)
}
msg_putchar('\n');
- msg_putchar(wp == curwin ? '>' : ' ');
+ msg_putchar(wp == curwin ? '>' : wp == lastused_win ? '#' : ' ');
msg_putchar(' ');
msg_putchar(bufIsChanged(wp->w_buffer) ? '+' : ' ');
msg_putchar(' ');
diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim
index a38625cca8..15b55d35c1 100644
--- a/src/nvim/testdir/test_startup.vim
+++ b/src/nvim/testdir/test_startup.vim
@@ -246,7 +246,7 @@ func Test_p_arg()
call assert_equal('Tab page 1', lines[0])
call assert_equal('> [No Name]', lines[1])
call assert_equal('Tab page 2', lines[2])
- call assert_equal(' [No Name]', lines[3])
+ call assert_equal('# [No Name]', lines[3])
endif
if RunVim([], after, '-p foo bar')
@@ -255,7 +255,7 @@ func Test_p_arg()
call assert_equal('Tab page 1', lines[0])
call assert_equal('> foo', lines[1])
call assert_equal('Tab page 2', lines[2])
- call assert_equal(' bar', lines[3])
+ call assert_equal('# bar', lines[3])
endif
call delete('Xtestout')
diff --git a/src/nvim/testdir/test_tabpage.vim b/src/nvim/testdir/test_tabpage.vim
index c35ddc4473..ce9f7adfef 100644
--- a/src/nvim/testdir/test_tabpage.vim
+++ b/src/nvim/testdir/test_tabpage.vim
@@ -548,7 +548,7 @@ func Test_tabs()
norm ixxx
let a=split(execute(':tabs'), "\n")
call assert_equal(['Tab page 1',
- \ ' [No Name]',
+ \ '# [No Name]',
\ 'Tab page 2',
\ '> + tab1'], a)
diff --git a/test/functional/autocmd/tabnewentered_spec.lua b/test/functional/autocmd/tabnewentered_spec.lua
index 949786d8ff..123dbd0824 100644
--- a/test/functional/autocmd/tabnewentered_spec.lua
+++ b/test/functional/autocmd/tabnewentered_spec.lua
@@ -85,7 +85,7 @@ describe('tabpage/previous', function()
Tab page 3
> [No Name]
Tab page 4
- [No Name]]=]),
+ # [No Name]]=]),
redir_exec('tabs')
)
@@ -122,7 +122,7 @@ describe('tabpage/previous', function()
Tab page 2
> [No Name]
Tab page 3
- [No Name]
+ # [No Name]
Tab page 4
[No Name]
Tab page 5
@@ -160,7 +160,7 @@ describe('tabpage/previous', function()
Tab page 1
- [No Name]
+ # [No Name]
Tab page 2
[No Name]
Tab page 3
@@ -208,7 +208,7 @@ describe('tabpage/previous', function()
Tab page 3
[No Name]
Tab page 4
- [No Name]]=]),
+ # [No Name]]=]),
redir_exec('tabs')
)
@@ -246,7 +246,7 @@ describe('tabpage/previous', function()
Tab page 2
[No Name]
Tab page 3
- [No Name]
+ # [No Name]
Tab page 4
> [No Name]]=]),
redir_exec('tabs')
@@ -284,7 +284,7 @@ describe('tabpage/previous', function()
Tab page 1
- [No Name]
+ # [No Name]
Tab page 2
[No Name]
Tab page 3
@@ -326,7 +326,7 @@ describe('tabpage/previous', function()
Tab page 1
[No Name]
Tab page 2
- [No Name]
+ # [No Name]
Tab page 3
[No Name]
Tab page 4
@@ -372,7 +372,7 @@ describe('tabpage/previous', function()
Tab page 3
[No Name]
Tab page 4
- [No Name]]=]),
+ # [No Name]]=]),
redir_exec('tabs')
)
@@ -516,4 +516,33 @@ describe('tabpage/previous', function()
cmdline_win_prevents_tab_switch('<C-W>g<Tab>', 1))
it('cmdline-win prevents tab switch via <C-Tab>',
cmdline_win_prevents_tab_switch('<C-Tab>', 0))
+
+ it(':tabs indicates correct prevtab curwin', function()
+ -- Add three tabs for a total of four
+ command('tabnew')
+ command('tabnew')
+ command('split')
+ command('vsplit')
+ feed('<C-w>p')
+ command('tabnew')
+
+ -- The previous tab is now the three.
+ eq(3, eval('tabpagenr(\'#\')'))
+
+ eq(dedent([=[
+
+
+ Tab page 1
+ [No Name]
+ Tab page 2
+ [No Name]
+ Tab page 3
+ [No Name]
+ # [No Name]
+ [No Name]
+ Tab page 4
+ > [No Name]]=]),
+ redir_exec('tabs')
+ )
+ end)
end)