annotate src/testdir/test_tabline.vim @ 14305:8a4c0ab88201 v8.1.0168

patch 8.1.0168: output of :marks is too short with multi-byte chars commit https://github.com/vim/vim/commit/9d5185bf9dfaef59e47c573a60044a21d5e29c0c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 8 17:57:34 2018 +0200 patch 8.1.0168: output of :marks is too short with multi-byte chars Problem: Output of :marks is too short with multi-byte chars. (Tony Mechelynck) Solution: Get more bytes from the text line.
author Christian Brabandt <cb@256bit.org>
date Sun, 08 Jul 2018 18:00:07 +0200
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