Mercurial > vim
annotate src/testdir/test_tabline.vim @ 21485:afc8cc1a291f v8.2.1293
patch 8.2.1293: Vim9: error when using vim9script in TextYankPost
Commit: https://github.com/vim/vim/commit/2d6b20d6a9a034b39f79a7dbb889fb5d859583ae
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 25 19:30:59 2020 +0200
patch 8.2.1293: Vim9: error when using vim9script in TextYankPost
Problem: Vim9: error when using vim9script in TextYankPost.
Solution: Use EX_LOCKOK instead of the EX_CMDWIN flag for command that can
be used when text is locked. (closes #6529)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 25 Jul 2020 19:45:04 +0200 |
parents | 53ff4dfe6e11 |
children | 08940efa6b4e |
rev | line source |
---|---|
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
1 |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
2 source shared.vim |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
3 |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
4 func TablineWithCaughtError() |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 let s:func_in_tabline_called = 1 |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 try |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call eval('unknown expression') |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 catch |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 endtry |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 return '' |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
11 endfunc |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
13 func TablineWithError() |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 let s:func_in_tabline_called = 1 |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call eval('unknown expression') |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 return '' |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
17 endfunc |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
19 func Test_caught_error_in_tabline() |
8874
ccab37bb9ac9
commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents:
8872
diff
changeset
|
20 if has('gui') |
ccab37bb9ac9
commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents:
8872
diff
changeset
|
21 set guioptions-=e |
ccab37bb9ac9
commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents:
8872
diff
changeset
|
22 endif |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 let showtabline_save = &showtabline |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 set showtabline=2 |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 let s:func_in_tabline_called = 0 |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 let tabline = '%{TablineWithCaughtError()}' |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 let &tabline = tabline |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 redraw! |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 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
|
30 call assert_equal(tabline, &tabline) |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 set tabline= |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 let &showtabline = showtabline_save |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
33 endfunc |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
35 func 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
|
36 if has('gui') |
ccab37bb9ac9
commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents:
8872
diff
changeset
|
37 set guioptions-=e |
ccab37bb9ac9
commit https://github.com/vim/vim/commit/73cd8fb3e87e4b29dfc489f58e56dee1839c18e5
Christian Brabandt <cb@256bit.org>
parents:
8872
diff
changeset
|
38 endif |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 let showtabline_save = &showtabline |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 set showtabline=2 |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 let s:func_in_tabline_called = 0 |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 let tabline = '%{TablineWithError()}' |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 try |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 let &tabline = tabline |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 redraw! |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 catch |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 endtry |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 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
|
49 call assert_equal('', &tabline) |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 set tabline= |
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 let &showtabline = showtabline_save |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
52 endfunc |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
53 |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
54 func Test_redrawtabline() |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
55 if has('gui') |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
56 set guioptions-=e |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
57 endif |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
58 let showtabline_save = &showtabline |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
59 set showtabline=2 |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
60 set tabline=%{bufnr('$')} |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
61 edit Xtabline1 |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
62 edit Xtabline2 |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
63 redraw |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
64 call assert_match(bufnr('$') . '', Screenline(1)) |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
65 au BufAdd * redrawtabline |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
66 badd Xtabline3 |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
67 call assert_match(bufnr('$') . '', Screenline(1)) |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
68 |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
69 set tabline= |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
70 let &showtabline = showtabline_save |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
71 au! Bufadd |
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
8874
diff
changeset
|
72 endfunc |
21004
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
73 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
74 " Test for the "%T" and "%X" flags in the 'tabline' option |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
75 func MyTabLine() |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
76 let s = '' |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
77 for i in range(tabpagenr('$')) |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
78 " set the tab page number (for mouse clicks) |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
79 let s .= '%' . (i + 1) . 'T' |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
80 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
81 " the label is made by MyTabLabel() |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
82 let s .= ' %{MyTabLabel(' . (i + 1) . ')} ' |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
83 endfor |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
84 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
85 " after the last tab fill with TabLineFill and reset tab page nr |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
86 let s .= '%T' |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
87 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
88 " right-align the label to close the current tab page |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
89 if tabpagenr('$') > 1 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
90 let s .= '%=%Xclose' |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
91 endif |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
92 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
93 return s |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
94 endfunc |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
95 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
96 func MyTabLabel(n) |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
97 let buflist = tabpagebuflist(a:n) |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
98 let winnr = tabpagewinnr(a:n) |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
99 return bufname(buflist[winnr - 1]) |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
100 endfunc |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
101 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
102 func Test_tabline_flags() |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
103 if has('gui') |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
104 set guioptions-=e |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
105 endif |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
106 set tabline=%!MyTabLine() |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
107 edit Xtabline1 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
108 tabnew Xtabline2 |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
109 redrawtabline |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
110 call assert_match('^ Xtabline1 Xtabline2\s\+close$', Screenline(1)) |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
111 set tabline= |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
112 %bw! |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
113 endfunc |
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
114 |
21417
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
115 function EmptyTabname() |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
116 return "" |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
117 endfunction |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
118 |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
119 function MakeTabLine() abort |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
120 let titles = map(range(1, tabpagenr('$')), '"%( %" . v:val . "T%{EmptyTabname()}%T %)"') |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
121 let sep = 'あ' |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
122 let tabpages = join(titles, sep) |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
123 return tabpages .. sep .. '%=%999X X' |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
124 endfunction |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
125 |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
126 func Test_tabline_empty_group() |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
127 " this was reading invalid memory |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
128 set tabline=%!MakeTabLine() |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
129 tabnew |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
130 redraw! |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
131 |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
132 tabclose |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
133 set tabline= |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
134 endfunc |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
135 |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
136 |
53ff4dfe6e11
patch 8.2.1259: empty group in 'tabline' may cause using an invalid pointer
Bram Moolenaar <Bram@vim.org>
parents:
21004
diff
changeset
|
137 |
21004
0650d220f742
patch 8.2.1053: insufficient testing for 'statusline' and 'tabline'
Bram Moolenaar <Bram@vim.org>
parents:
15396
diff
changeset
|
138 " vim: shiftwidth=2 sts=2 expandtab |