comparison src/testdir/test_tabline.vim @ 15396:325e4a8ba1b6 v8.1.0706

patch 8.1.0706: tabline is not always redrawn commit https://github.com/vim/vim/commit/e12bab3144af8943937bd0ff4bc57f04e53037b3 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 8 22:02:56 2019 +0100 patch 8.1.0706: tabline is not always redrawn Problem: Tabline is not always redrawn when something that is used in 'tabline' changes. Solution: Add ":redrawtabline" so that a plugin can at least cause the redraw when needed.
author Bram Moolenaar <Bram@vim.org>
date Tue, 08 Jan 2019 22:15:05 +0100
parents ccab37bb9ac9
children 0650d220f742
comparison
equal deleted inserted replaced
15395:989d5000e18e 15396:325e4a8ba1b6
1 function! TablineWithCaughtError() 1
2 source shared.vim
3
4 func TablineWithCaughtError()
2 let s:func_in_tabline_called = 1 5 let s:func_in_tabline_called = 1
3 try 6 try
4 call eval('unknown expression') 7 call eval('unknown expression')
5 catch 8 catch
6 endtry 9 endtry
7 return '' 10 return ''
8 endfunction 11 endfunc
9 12
10 function! TablineWithError() 13 func TablineWithError()
11 let s:func_in_tabline_called = 1 14 let s:func_in_tabline_called = 1
12 call eval('unknown expression') 15 call eval('unknown expression')
13 return '' 16 return ''
14 endfunction 17 endfunc
15 18
16 function! Test_caught_error_in_tabline() 19 func Test_caught_error_in_tabline()
17 if has('gui') 20 if has('gui')
18 set guioptions-=e 21 set guioptions-=e
19 endif 22 endif
20 let showtabline_save = &showtabline 23 let showtabline_save = &showtabline
21 set showtabline=2 24 set showtabline=2
25 redraw! 28 redraw!
26 call assert_true(s:func_in_tabline_called) 29 call assert_true(s:func_in_tabline_called)
27 call assert_equal(tabline, &tabline) 30 call assert_equal(tabline, &tabline)
28 set tabline= 31 set tabline=
29 let &showtabline = showtabline_save 32 let &showtabline = showtabline_save
30 endfunction 33 endfunc
31 34
32 function! Test_tabline_will_be_disabled_with_error() 35 func Test_tabline_will_be_disabled_with_error()
33 if has('gui') 36 if has('gui')
34 set guioptions-=e 37 set guioptions-=e
35 endif 38 endif
36 let showtabline_save = &showtabline 39 let showtabline_save = &showtabline
37 set showtabline=2 40 set showtabline=2
44 endtry 47 endtry
45 call assert_true(s:func_in_tabline_called) 48 call assert_true(s:func_in_tabline_called)
46 call assert_equal('', &tabline) 49 call assert_equal('', &tabline)
47 set tabline= 50 set tabline=
48 let &showtabline = showtabline_save 51 let &showtabline = showtabline_save
49 endfunction 52 endfunc
53
54 func Test_redrawtabline()
55 if has('gui')
56 set guioptions-=e
57 endif
58 let showtabline_save = &showtabline
59 set showtabline=2
60 set tabline=%{bufnr('$')}
61 edit Xtabline1
62 edit Xtabline2
63 redraw
64 call assert_match(bufnr('$') . '', Screenline(1))
65 au BufAdd * redrawtabline
66 badd Xtabline3
67 call assert_match(bufnr('$') . '', Screenline(1))
68
69 set tabline=
70 let &showtabline = showtabline_save
71 au! Bufadd
72 endfunc