annotate src/testdir/test_listlbr.vim @ 26974:fceb494e22de v8.2.4016

patch 8.2.4016: Vim9: incorrect error for argument that is shadowing var Commit: https://github.com/vim/vim/commit/58493cfae255adec2d5b407593b82d07abcc0975 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 6 12:23:30 2022 +0000 patch 8.2.4016: Vim9: incorrect error for argument that is shadowing var Problem: Vim9: incorrect error for argument that is shadowing var. Solution: Ignore variable that is not in block where the function was defined.
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Jan 2022 13:30:04 +0100
parents 44be09b25619
children 218363931f5d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for linebreak and list option (non-utf8)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 set encoding=latin1
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 scriptencoding latin1
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
6 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
7 CheckOption linebreak
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
8 CheckFeature conceal
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 source view_util.vim
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 function s:screen_lines(lnum, width) abort
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 return ScreenLines(a:lnum, a:width)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endfunction
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11010
diff changeset
16 func s:compare_lines(expect, actual)
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11010
diff changeset
18 endfunc
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 function s:test_windows(...)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call NewWindow(10, 20)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 setl ts=8 sw=4 sts=4 linebreak sbr= wrap
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 exe get(a:000, 0, '')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 endfunction
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 function s:close_windows(...)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call CloseWindow()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 exe get(a:000, 0, '')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 endfunction
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 func Test_set_linebreak()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call s:test_windows('setl ts=4 sbr=+')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ " abcdef ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ "+hijklmn ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ "+pqrstuvwxyz_1060ABC",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 \ "+DEFGHIJKLMNOP ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 func Test_linebreak_with_list()
23952
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
46 set listchars=
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call s:test_windows('setl ts=4 sbr=+ list listchars=')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 \ "^Iabcdef hijklmn^I ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 \ "+pqrstuvwxyz_1060ABC",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 \ "+DEFGHIJKLMNOP ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call s:close_windows()
23952
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
58 set listchars&vim
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 func Test_linebreak_with_nolist()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call s:test_windows('setl ts=4 sbr=+ nolist')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 \ " abcdef ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 \ "+hijklmn ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 \ "+pqrstuvwxyz_1060ABC",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 \ "+DEFGHIJKLMNOP ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 func Test_should_break()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 call s:test_windows('setl sbr=+ nolist')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 call setline(1, "1\t" . repeat('a', winwidth(0)-2))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 \ "1 ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 \ "+aaaaaaaaaaaaaaaaaa ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 func Test_linebreak_with_conceal()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 call s:test_windows('setl cpo&vim sbr=+ list conceallevel=2 concealcursor=nv listchars=tab:ab')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 call setline(1, "_S_\t bla")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 syn match ConcealVar contained /_/ conceal
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 syn match All /.*/ contains=ConcealVar
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 \ "Sabbbbbb bla ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104
19176
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
105 func Test_linebreak_with_visual_operations()
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
106 call s:test_windows()
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
107 let line = '1234567890 2234567890 3234567890'
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
108 call setline(1, line)
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
109
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
110 " yank
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
111 exec "norm! ^w\<C-V>ey"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
112 call assert_equal('2234567890', @@)
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
113 exec "norm! w\<C-V>ey"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
114 call assert_equal('3234567890', @@)
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
115
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
116 " increment / decrement
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
117 exec "norm! ^w\<C-V>\<C-A>w\<C-V>\<C-X>"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
118 call assert_equal('1234567890 3234567890 2234567890', getline(1))
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
119
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
120 " replace
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
121 exec "norm! ^w\<C-V>3lraw\<C-V>3lrb"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
122 call assert_equal('1234567890 aaaa567890 bbbb567890', getline(1))
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
123
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
124 " tilde
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
125 exec "norm! ^w\<C-V>2l~w\<C-V>2l~"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
126 call assert_equal('1234567890 AAAa567890 BBBb567890', getline(1))
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
127
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
128 " delete and insert
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
129 exec "norm! ^w\<C-V>3lc2345\<Esc>w\<C-V>3lc3456\<Esc>"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
130 call assert_equal('1234567890 2345567890 3456567890', getline(1))
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
131 call assert_equal('BBBb', @@)
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
132
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
133 call s:close_windows()
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
134 endfunc
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
135
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 func Test_virtual_block()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 call s:test_windows('setl sbr=+')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 call setline(1, [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 \ "REMOVE: this not",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 \ "REMOVE: aaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 \ ])
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 exe "norm! 1/^REMOVE:"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 exe "norm! 0\<C-V>jf x"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 $put
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 \ "this not ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 \ "aaaaaaaaaaaaa ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 \ "REMOVE: ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 \ "REMOVE: ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 func Test_virtual_block_and_vbA()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 call setline(1, "long line: " . repeat("foobar ", 40) . "TARGET at end")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 exe "norm! $3B\<C-v>eAx\<Esc>"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 let lines = s:screen_lines([1, 10], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 \ "foobar TARGETx at ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 func Test_virtual_char_and_block()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 call setline(1, "1111-1111-1111-11-1111-1111-1111")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 exe "norm! 0f-lv3lc2222\<Esc>bgj."
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 let lines = s:screen_lines([1, 2], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 \ "1111-2222-1111-11- ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 \ "1111-2222-1111 ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 func Test_undo_after_block_visual()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 call setline(1, ["aaa", "aaa", "a"])
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 exe "norm! gg\<C-V>2j~e."
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 let lines = s:screen_lines([1, 3], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 \ "AaA ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 \ "AaA ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 \ "A ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 func Test_norm_after_block_visual()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 call setline(1, ["abcd{ef", "ghijklm", "no}pgrs"])
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 exe "norm! ggf{\<C-V>\<C-V>c%"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 let lines = s:screen_lines([1, 3], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 \ "abcdpgrs ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 func Test_block_replace_after_wrapping()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 call setline(1, repeat("a", 150))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 exe "norm! 0yypk147|\<C-V>jr0"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 call assert_equal(repeat("a", 146) . "0aaa", getline(1))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 call assert_equal(repeat("a", 146) . "0aaa", getline(2))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 let lines = s:screen_lines([1, 10], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 \ "aaaaaa0aaa ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 \ "@ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 \ "@ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 func Test_list_with_listchars()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 call s:test_windows('setl list listchars=space:_,trail:-,tab:>-,eol:$')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 call setline(1, "a aaaaaaaaaaaaaaaaaaaaaa\ta ")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 let lines = s:screen_lines([1, 3], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 \ "a_ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 \ "aa>-----a-$ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 endfunc
11010
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
253
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
254 func Test_list_with_tab_and_skipping_first_chars()
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
255 call s:test_windows('setl list listchars=tab:>- ts=70 nowrap')
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
256 call setline(1, ["iiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa"])
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
257 call cursor(4,64)
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
258 norm! 2zl
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
259 let lines = s:screen_lines([1, 4], winwidth(0))
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
260 let expect = [
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
261 \ "---------------aaaaa",
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
262 \ "---------------aaaaa",
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
263 \ "---------------aaaaa",
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
264 \ "iiiiiiiii>-----aaaaa",
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
265 \ ]
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
266 call s:compare_lines(expect, lines)
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
267 call s:close_windows()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19176
diff changeset
268 endfunc
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19176
diff changeset
269
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19176
diff changeset
270 " vim: shiftwidth=2 sts=2 expandtab