Merge #11735 ':tabs : show # for previous tabpage'

This commit is contained in:
Justin M. Keyes 2020-01-19 22:25:53 -08:00 committed by GitHub
commit 270cd623ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 12 deletions

View File

@ -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(' ');

View File

@ -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')

View File

@ -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)

View File

@ -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)