annotate src/testdir/test_tabline.vim @ 15062:3a94f7918980 v8.1.0542

patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account commit https://github.com/vim/vim/commit/f951416a8396a54bbbe21de1a8b16716428549f2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 22 03:08:29 2018 +0100 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account Problem: shiftwidth() does not take 'vartabstop' into account. Solution: Use the cursor position or a position explicitly passed. Also make >> and << work better with 'vartabstop'. (Christian Brabandt)
author Bram Moolenaar <Bram@vim.org>
date Thu, 22 Nov 2018 03:15:10 +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