annotate src/testdir/test_tabline.vim @ 12996:973a0037f4c3 v8.0.1374

patch 8.0.1374: CTRL-A does not work with an empty line commit https://github.com/vim/vim/commit/5fe6bdf858a7f2f288d599ffb5efb3c08449c817 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Dec 5 17:22:12 2017 +0100 patch 8.0.1374: CTRL-A does not work with an empty line Problem: CTRL-A does not work with an empty line. (Alex) Solution: Decrement the end only once. (Hirohito Higashi, closes https://github.com/vim/vim/issues/2387)
author Christian Brabandt <cb@256bit.org>
date Tue, 05 Dec 2017 17:30:05 +0100
parents ccab37bb9ac9
children 325e4a8ba1b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8872
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 function! TablineWithCaughtError()
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 let s:func_in_tabline_called = 1
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 try
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 call eval('unknown expression')
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 catch
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 endtry
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 return ''
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endfunction
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 function! TablineWithError()
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let s:func_in_tabline_called = 1
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 call eval('unknown expression')
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 return ''
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endfunction
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 function! Test_caught_error_in_tabline()
8874
ccab37bb9ac9 commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents: 8872
diff changeset
17 if has('gui')
ccab37bb9ac9 commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents: 8872
diff changeset
18 set guioptions-=e
ccab37bb9ac9 commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents: 8872
diff changeset
19 endif
8872
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 let showtabline_save = &showtabline
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 set showtabline=2
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 let s:func_in_tabline_called = 0
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 let tabline = '%{TablineWithCaughtError()}'
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 let &tabline = tabline
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 redraw!
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call assert_true(s:func_in_tabline_called)
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call assert_equal(tabline, &tabline)
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 set tabline=
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 let &showtabline = showtabline_save
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 endfunction
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 function! Test_tabline_will_be_disabled_with_error()
8874
ccab37bb9ac9 commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents: 8872
diff changeset
33 if has('gui')
ccab37bb9ac9 commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents: 8872
diff changeset
34 set guioptions-=e
ccab37bb9ac9 commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents: 8872
diff changeset
35 endif
8872
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 let showtabline_save = &showtabline
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 set showtabline=2
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 let s:func_in_tabline_called = 0
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 let tabline = '%{TablineWithError()}'
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 try
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 let &tabline = tabline
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 redraw!
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 catch
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 endtry
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_true(s:func_in_tabline_called)
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal('', &tabline)
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 set tabline=
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 let &showtabline = showtabline_save
4d4de770f970 commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 endfunction