annotate src/testdir/test_statusline.vim @ 20984:fe06ee7d3511 v8.2.1043

patch 8.2.1043: %a item in 'statusline' not tested Commit: https://github.com/vim/vim/commit/4014e2ceb03b8aeb947a0c671a099b677c8f2d5d Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 23 20:00:50 2020 +0200 patch 8.2.1043: %a item in 'statusline' not tested Problem: %a item in 'statusline' not tested. Solution: Add a test. (Dominique Pell?, closes https://github.com/vim/vim/issues/6318)
author Bram Moolenaar <Bram@vim.org>
date Tue, 23 Jun 2020 20:15:07 +0200
parents c087099e9163
children 0650d220f742
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
1 " Test 'statusline'
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
2 "
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
3 " Not tested yet:
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
4 " %a
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
5 " %N
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
6 " %T
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
7 " %X
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
8
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
9 source view_util.vim
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18746
diff changeset
10 source check.vim
19354
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
11 source screendump.vim
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
12
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
13 func s:get_statusline()
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
14 return ScreenLines(&lines - 1, &columns)[0]
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
15 endfunc
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
16
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
17 func StatuslineWithCaughtError()
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let s:func_in_statusline_called = 1
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 try
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call eval('unknown expression')
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 catch
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 endtry
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 return ''
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
24 endfunc
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
26 func StatuslineWithError()
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let s:func_in_statusline_called = 1
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call eval('unknown expression')
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 return ''
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
30 endfunc
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
32 " Function used to display syntax group.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
33 func SyntaxItem()
16740
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
34 call assert_equal(s:expected_curbuf, g:actual_curbuf)
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
35 call assert_equal(s:expected_curwin, g:actual_curwin)
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
36 return synIDattr(synID(line("."), col("."),1), "name")
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
37 endfunc
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
38
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
39 func Test_caught_error_in_statusline()
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 let s:func_in_statusline_called = 0
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 set laststatus=2
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 let statusline = '%{StatuslineWithCaughtError()}'
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 let &statusline = statusline
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 redrawstatus
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_true(s:func_in_statusline_called)
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal(statusline, &statusline)
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 set statusline=
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
48 endfunc
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
50 func Test_statusline_will_be_disabled_with_error()
8847
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 let s:func_in_statusline_called = 0
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 set laststatus=2
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 let statusline = '%{StatuslineWithError()}'
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 try
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 let &statusline = statusline
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 redrawstatus
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 catch
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 endtry
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call assert_true(s:func_in_statusline_called)
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call assert_equal('', &statusline)
470ea7526cc6 commit https://github.com/vim/vim/commit/a742e084b677f76c67e9e52c4f9fb9ab24002e20
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 set statusline=
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
62 endfunc
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
63
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
64 func Test_statusline()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18746
diff changeset
65 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18746
diff changeset
66
20984
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
67 " %a: Argument list ({current} of {max})
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
68 set statusline=%a
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
69 call assert_match('^\s*$', s:get_statusline())
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
70 arglocal a1 a2
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
71 rewind
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
72 call assert_match('^ (1 of 2)\s*$', s:get_statusline())
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
73 next
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
74 call assert_match('^ (2 of 2)\s*$', s:get_statusline())
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
75 e Xstatusline
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
76 call assert_match('^ ((2) of 2)\s*$', s:get_statusline())
fe06ee7d3511 patch 8.2.1043: %a item in 'statusline' not tested
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
77
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
78 only
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
79 set laststatus=2
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
80 set splitbelow
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
81 call setline(1, range(1, 10000))
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
82
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
83 " %b: Value of character under cursor.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
84 " %B: As above, in hexadecimal.
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
85 call cursor(9000, 1)
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
86 set statusline=%b,%B
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
87 call assert_match('^57,39\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
88
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
89 " %o: Byte number in file of byte under cursor, first byte is 1.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
90 " %O: As above, in hexadecimal.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
91 set statusline=%o,%O
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
92 set fileformat=dos
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
93 call assert_match('^52888,CE98\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
94 set fileformat=mac
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
95 call assert_match('^43889,AB71\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
96 set fileformat=unix
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
97 call assert_match('^43889,AB71\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
98 set fileformat&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
99
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
100 " %f: Path to the file in the buffer, as typed or relative to current dir.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
101 set statusline=%f
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
102 call assert_match('^Xstatusline\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
103
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
104 " %F: Full path to the file in the buffer.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
105 set statusline=%F
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
106 call assert_match('/testdir/Xstatusline\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
107
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
108 " %h: Help buffer flag, text is "[help]".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
109 " %H: Help buffer flag, text is ",HLP".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
110 set statusline=%h,%H
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
111 call assert_match('^,\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
112 help
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
113 call assert_match('^\[Help\],HLP\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
114 helpclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
115
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
116 " %k: Value of "b:keymap_name" or 'keymap'
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
117 " when :lmap mappings are being used: <keymap>"
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
118 set statusline=%k
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
119 if has('keymap')
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
120 set keymap=esperanto
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
121 call assert_match('^<Eo>\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
122 set keymap&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
123 else
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
124 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
125 endif
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
126
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
127 " %l: Line number.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
128 " %L: Number of line in buffer.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
129 " %c: Column number.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
130 set statusline=%l/%L,%c
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
131 call assert_match('^9000/10000,1\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
132
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
133 " %m: Modified flag, text is "[+]", "[-]" if 'modifiable' is off.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
134 " %M: Modified flag, text is ",+" or ",-".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
135 set statusline=%m%M
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
136 call assert_match('^\[+\],+\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
137 set nomodifiable
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
138 call assert_match('^\[+-\],+-\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
139 write
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
140 call assert_match('^\[-\],-\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
141 set modifiable&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
142 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
143
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
144 " %n: Buffer number.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
145 set statusline=%n
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
146 call assert_match('^'.bufnr('%').'\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
147
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
148 " %p: Percentage through file in lines as in CTRL-G.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
149 " %P: Percentage through file of displayed window.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
150 set statusline=%p,%P
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
151 0
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
152 call assert_match('^0,Top\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
153 norm G
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
154 call assert_match('^100,Bot\s*$', s:get_statusline())
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
155 9000
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
156 " Don't check the exact percentage as it depends on the window size
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
157 call assert_match('^90,\(Top\|Bot\|\d\+%\)\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
158
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
159 " %q: "[Quickfix List]", "[Location List]" or empty.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
160 set statusline=%q
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
161 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
162 copen
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
163 call assert_match('^\[Quickfix List\]\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
164 cclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
165 lexpr getline(1, 2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
166 lopen
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
167 call assert_match('^\[Location List\]\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
168 lclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
169
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
170 " %r: Readonly flag, text is "[RO]".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
171 " %R: Readonly flag, text is ",RO".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
172 set statusline=%r,%R
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
173 call assert_match('^,\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
174 help
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
175 call assert_match('^\[RO\],RO\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
176 helpclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
177
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
178 " %t: File name (tail) of file in the buffer.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
179 set statusline=%t
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
180 call assert_match('^Xstatusline\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
181
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
182 " %v: Virtual column number.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
183 " %V: Virtual column number as -{num}. Not displayed if equal to 'c'.
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
184 call cursor(9000, 2)
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
185 set statusline=%v,%V
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
186 call assert_match('^2,\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
187 set virtualedit=all
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
188 norm 10|
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
189 call assert_match('^10,-10\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
190 set virtualedit&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
191
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
192 " %w: Preview window flag, text is "[Preview]".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
193 " %W: Preview window flag, text is ",PRV".
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
194 set statusline=%w%W
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
195 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
196 pedit
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
197 wincmd j
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
198 call assert_match('^\[Preview\],PRV\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
199 pclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
200
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
201 " %y: Type of file in the buffer, e.g., "[vim]". See 'filetype'.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
202 " %Y: Type of file in the buffer, e.g., ",VIM". See 'filetype'.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
203 set statusline=%y\ %Y
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
204 call assert_match('^\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
205 setfiletype vim
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
206 call assert_match('^\[vim\] VIM\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
207
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
208 " %=: Separation point between left and right aligned items.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
209 set statusline=foo%=bar
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
210 call assert_match('^foo\s\+bar\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
211
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
212 " Test min/max width, leading zeroes, left/right justify.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
213 set statusline=%04B
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
214 call cursor(9000, 1)
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
215 call assert_match('^0039\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
216 set statusline=#%4B#
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
217 call assert_match('^# 39#\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
218 set statusline=#%-4B#
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
219 call assert_match('^#39 #\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
220 set statusline=%.6f
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
221 call assert_match('^<sline\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
222
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
223 " %<: Where to truncate.
16332
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
224 " First check with when %< should not truncate with many columns
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
225 exe 'set statusline=a%<b' . repeat('c', &columns - 3) . 'd'
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
226 call assert_match('^abc\+d$', s:get_statusline())
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
227 exe 'set statusline=a' . repeat('b', &columns - 2) . '%<c'
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
228 call assert_match('^ab\+c$', s:get_statusline())
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
229 " Then check when %< should truncate when there with too few columns.
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
230 exe 'set statusline=a%<b' . repeat('c', &columns - 2) . 'd'
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
231 call assert_match('^a<c\+d$', s:get_statusline())
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
232 exe 'set statusline=a' . repeat('b', &columns - 1) . '%<c'
97e15f5b0082 patch 8.1.1171: statusline test could fail in large terminal
Bram Moolenaar <Bram@vim.org>
parents: 12684
diff changeset
233 call assert_match('^ab\+>$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
234
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
235 "%{: Evaluate expression between '%{' and '}' and substitute result.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
236 syntax on
16740
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
237 let s:expected_curbuf = string(bufnr(''))
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
238 let s:expected_curwin = string(win_getid())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
239 set statusline=%{SyntaxItem()}
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
240 call assert_match('^vimNumber\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
241 s/^/"/
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
242 call assert_match('^vimLineComment\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
243 syntax off
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
244
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
245 "%(: Start of item group.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
246 set statusline=ab%(cd%q%)de
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
247 call assert_match('^abde\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
248 copen
11525
14b6b79d685b patch 8.0.0645: no error for illegal back reference in NFA engine
Christian Brabandt <cb@256bit.org>
parents: 11075
diff changeset
249 call assert_match('^abcd\[Quickfix List]de\s*$', s:get_statusline())
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
250 cclose
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
251
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
252 " %#: Set highlight group. The name must follow and then a # again.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
253 set statusline=ab%#Todo#cd%#Error#ef
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
254 call assert_match('^abcdef\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
255 let sa1=screenattr(&lines - 1, 1)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
256 let sa2=screenattr(&lines - 1, 3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
257 let sa3=screenattr(&lines - 1, 5)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
258 call assert_notequal(sa1, sa2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
259 call assert_notequal(sa1, sa3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
260 call assert_notequal(sa2, sa3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
261 call assert_equal(sa1, screenattr(&lines - 1, 2))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
262 call assert_equal(sa2, screenattr(&lines - 1, 4))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
263 call assert_equal(sa3, screenattr(&lines - 1, 6))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
264 call assert_equal(sa3, screenattr(&lines - 1, 7))
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
265
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
266 " %*: Set highlight group to User{N}
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
267 set statusline=a%1*b%0*c
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
268 call assert_match('^abc\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
269 let sa1=screenattr(&lines - 1, 1)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
270 let sa2=screenattr(&lines - 1, 2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
271 let sa3=screenattr(&lines - 1, 3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
272 call assert_equal(sa1, sa3)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
273 call assert_notequal(sa1, sa2)
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
274
12660
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
275 " An empty group that contains highlight changes
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
276 let g:a = ''
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
277 set statusline=ab%(cd%1*%{g:a}%*%)de
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
278 call assert_match('^abde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
279 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
280 let sa2=screenattr(&lines - 1, 4)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
281 call assert_equal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
282 let g:a = 'X'
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
283 call assert_match('^abcdXde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
284 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
285 let sa2=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
286 let sa3=screenattr(&lines - 1, 7)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
287 call assert_equal(sa1, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
288 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
289
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
290 let g:a = ''
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
291 set statusline=ab%1*%(cd%*%{g:a}%1*%)de
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
292 call assert_match('^abde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
293 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
294 let sa2=screenattr(&lines - 1, 4)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
295 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
296 let g:a = 'X'
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
297 call assert_match('^abcdXde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
298 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
299 let sa2=screenattr(&lines - 1, 3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
300 let sa3=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
301 let sa4=screenattr(&lines - 1, 7)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
302 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
303 call assert_equal(sa1, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
304 call assert_equal(sa2, sa4)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
305
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
306 " An empty group that contains highlight changes and doesn't reset them
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
307 let g:a = ''
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
308 set statusline=ab%(cd%1*%{g:a}%)de
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
309 call assert_match('^abcdde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
310 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
311 let sa2=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
312 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
313 let g:a = 'X'
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
314 call assert_match('^abcdXde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
315 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
316 let sa2=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
317 let sa3=screenattr(&lines - 1, 7)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
318 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
319 call assert_equal(sa2, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
320
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
321 let g:a = ''
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
322 set statusline=ab%1*%(cd%*%{g:a}%)de
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
323 call assert_match('^abcdde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
324 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
325 let sa2=screenattr(&lines - 1, 3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
326 let sa3=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
327 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
328 call assert_equal(sa1, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
329 let g:a = 'X'
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
330 call assert_match('^abcdXde\s*$', s:get_statusline())
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
331 let sa1=screenattr(&lines - 1, 1)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
332 let sa2=screenattr(&lines - 1, 3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
333 let sa3=screenattr(&lines - 1, 5)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
334 let sa4=screenattr(&lines - 1, 7)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
335 call assert_notequal(sa1, sa2)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
336 call assert_equal(sa1, sa3)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
337 call assert_equal(sa1, sa4)
ac6e56d8950e patch 8.0.1208: 'statusline' drops empty group with highlight change
Christian Brabandt <cb@256bit.org>
parents: 11525
diff changeset
338
12684
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
339 let g:a = ''
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
340 set statusline=%#Error#{%(\ %{g:a}\ %)}
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
341 call assert_match('^{}\s*$', s:get_statusline())
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
342 let g:a = 'X'
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
343 call assert_match('^{ X }\s*$', s:get_statusline())
185f8dbdcf26 patch 8.0.1220: skipping empty statusline groups is not correct
Christian Brabandt <cb@256bit.org>
parents: 12660
diff changeset
344
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
345 " %%: a percent sign.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
346 set statusline=10%%
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
347 call assert_match('^10%\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
348
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
349 " %!: evaluated expression is used as the option value
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
350 set statusline=%!2*3+1
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
351 call assert_match('7\s*$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
352
16740
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
353 func GetNested()
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
354 call assert_equal(string(win_getid()), g:actual_curwin)
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
355 call assert_equal(string(bufnr('')), g:actual_curbuf)
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
356 return 'nested'
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
357 endfunc
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
358 func GetStatusLine()
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
359 call assert_equal(win_getid(), g:statusline_winid)
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
360 return 'the %{GetNested()} line'
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
361 endfunc
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
362 set statusline=%!GetStatusLine()
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
363 call assert_match('the nested line', s:get_statusline())
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
364 call assert_false(exists('g:actual_curwin'))
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
365 call assert_false(exists('g:actual_curbuf'))
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
366 call assert_false(exists('g:statusline_winid'))
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
367 delfunc GetNested
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
368 delfunc GetStatusLine
dc85d49349f7 patch 8.1.1372: when evaluating 'statusline' the current window is unknown
Bram Moolenaar <Bram@vim.org>
parents: 16332
diff changeset
369
11075
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
370 " Check statusline in current and non-current window
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
371 " with the 'fillchars' option.
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
372 set fillchars=stl:^,stlnc:=,vert:\|,fold:-,diff:-
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
373 vsplit
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
374 set statusline=x%=y
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
375 call assert_match('^x^\+y^x=\+y$', s:get_statusline())
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
376 set fillchars&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
377 close
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
378
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
379 %bw!
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
380 call delete('Xstatusline')
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
381 set statusline&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
382 set laststatus&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
383 set splitbelow&
a8be0c7169b1 patch 8.0.0426: insufficient testing for statusline
Christian Brabandt <cb@256bit.org>
parents: 8847
diff changeset
384 endfunc
18746
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
385
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
386 func Test_statusline_visual()
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
387 func CallWordcount()
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
388 call wordcount()
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
389 endfunc
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
390 new x1
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
391 setl statusline=count=%{CallWordcount()}
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
392 " buffer must not be empty
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
393 call setline(1, 'hello')
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
394
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
395 " window with more lines than x1
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
396 new x2
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
397 call setline(1, range(10))
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
398 $
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
399 " Visual mode in line below liast line in x1 should not give ml_get error
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
400 call feedkeys("\<C-V>", "xt")
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
401 redraw
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
402
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
403 delfunc CallWordcount
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
404 bwipe! x1
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
405 bwipe! x2
64eea864dff6 patch 8.1.2363: ml_get error when accessing Visual area in 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 16740
diff changeset
406 endfunc
19354
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
407
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
408 func Test_statusline_removed_group()
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
409 CheckScreendump
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
410
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
411 let lines =<< trim END
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
412 scriptencoding utf-8
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
413 set laststatus=2
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
414 let &statusline = '%#StatColorHi2#%(✓%#StatColorHi2#%) Q≡'
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
415 END
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
416 call writefile(lines, 'XTest_statusline')
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
417
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
418 let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 10, 'cols': 50})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19354
diff changeset
419 call TermWait(buf, 50)
19354
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
420 call VerifyScreenDump(buf, 'Test_statusline_1', {})
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
421
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
422 " clean up
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
423 call StopVimInTerminal(buf)
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
424 call delete('XTest_statusline')
1d3b2ce65ae0 patch 8.2.0235: draw error when an empty group is removed from 'statusline'
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
425 endfunc