annotate src/testdir/test_vartabs.vim @ 16376:3b5d401a58ce v8.1.1193

patch 8.1.1193: typos and small problems in test files commit https://github.com/vim/vim/commit/037c54f261818439755d56e318da068f97997fb5 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 20 23:47:46 2019 +0200 patch 8.1.1193: typos and small problems in test files Problem: Typos and small problems in test files. Solution: Small improvements.
author Bram Moolenaar <Bram@vim.org>
date Sun, 21 Apr 2019 00:00:04 +0200
parents 63b02fcf1361
children f38fcbf343ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for variable tabstops
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has("vartabs")
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
7 source view_util.vim
16376
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
8
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
9 func s:compare_lines(expect, actual)
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
10 call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
11 endfunc
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
12
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
13 func Test_vartabs()
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 %d
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " Test normal operation of tabstops ...
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 set ts=4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call setline(1, join(split('aaaaa', '\zs'), "\t"))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 retab 8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 let expect = "a a\<tab>a a\<tab>a"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " ... and softtabstops
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 set ts=8 sts=6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 exe "norm! Sb\<tab>b\<tab>b\<tab>b\<tab>b"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 let expect = "b b\<tab> b\<tab> b\<tab>b"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " Test variable tabstops.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 set sts=0 vts=4,8,4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 exe "norm! Sc\<tab>c\<tab>c\<tab>c\<tab>c\<tab>c"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 retab 8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 let expect = "c c\<tab> c\<tab>c\<tab>c\<tab>c"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 set et vts=4,8,4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 exe "norm! Sd\<tab>d\<tab>d\<tab>d\<tab>d\<tab>d"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 let expect = "d d d d d d"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 " Changing ts should have no effect if vts is in use.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 call cursor(1, 1)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 set ts=6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 exe "norm! Se\<tab>e\<tab>e\<tab>e\<tab>e\<tab>e"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 let expect = "e e e e e e"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 " Clearing vts should revert to using ts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 set vts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 exe "norm! Sf\<tab>f\<tab>f\<tab>f\<tab>f\<tab>f"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 let expect = "f f f f f f"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 " Test variable softtabstops.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 set noet ts=8 vsts=12,2,6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 exe "norm! Sg\<tab>g\<tab>g\<tab>g\<tab>g\<tab>g"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 let expect = "g\<tab> g g\<tab> g\<tab> g\<tab>g"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 " Variable tabstops and softtabstops combined.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 set vsts=6,12,8 vts=4,6,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 exe "norm! Sh\<tab>h\<tab>h\<tab>h\<tab>h"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 let expect = "h\<tab> h\<tab>\<tab>h\<tab>h\<tab>h"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 " Retab with a single value, not using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 set ts=8 sts=0 vts= vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 exe "norm! Si\<tab>i\<tab>i\<tab>i\<tab>i"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 retab 4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 let expect = "i\<tab>\<tab>i\<tab>\<tab>i\<tab>\<tab>i\<tab>\<tab>i"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 " Retab with a single value, using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 set ts=8 sts=0 vts=6 vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 exe "norm! Sj\<tab>j\<tab>j\<tab>j\<tab>j"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 retab 4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 let expect = "j\<tab> j\<tab>\<tab>j\<tab> j\<tab>\<tab>j"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 " Retab with multiple values, not using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 set ts=6 sts=0 vts= vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 exe "norm! Sk\<tab>k\<tab>k\<tab>k\<tab>k\<tab>k"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 retab 4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 let expect = "k\<tab> k\<tab>k k\<tab> k\<tab> k"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 " Retab with multiple values, using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 set ts=8 sts=0 vts=6 vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 exe "norm! Sl\<tab>l\<tab>l\<tab>l\<tab>l\<tab>l"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 retab 4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 let expect = "l\<tab> l\<tab>l l\<tab> l\<tab> l"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 " Check that global and local values are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 set ts=4 vts=6 sts=8 vsts=10
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 " Check that local values only are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 setlocal ts=5 vts=7 sts=9 vsts=11
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 call assert_equal(&ts, 5)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 call assert_equal(&vts, '7')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 call assert_equal(&sts, 9)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 call assert_equal(&vsts, '11')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 " Check that global values only are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 setglobal ts=6 vts=8 sts=10 vsts=12
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 call assert_equal(&ts, 5)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 call assert_equal(&vts, '7')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 call assert_equal(&sts, 9)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 call assert_equal(&vsts, '11')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 call assert_equal(&ts, 6)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 call assert_equal(&vts, '8')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 call assert_equal(&sts, 10)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 call assert_equal(&vsts, '12')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 set ts& vts& sts& vsts& et&
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 endfunc
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 15062
diff changeset
138 func Test_vartabs_breakindent()
14175
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 if !exists("+breakindent")
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 return
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 endif
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 %d
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 " Test normal operation of tabstops ...
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 set ts=4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 call setline(1, join(split('aaaaa', '\zs'), "\t"))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 retab 8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 let expect = "a a\<tab>a a\<tab>a"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 " ... and softtabstops
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 set ts=8 sts=6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 exe "norm! Sb\<tab>b\<tab>b\<tab>b\<tab>b"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 let expect = "b b\<tab> b\<tab> b\<tab>b"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 " Test variable tabstops.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 set sts=0 vts=4,8,4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 exe "norm! Sc\<tab>c\<tab>c\<tab>c\<tab>c\<tab>c"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 retab 8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 let expect = "c c\<tab> c\<tab>c\<tab>c\<tab>c"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 set et vts=4,8,4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 exe "norm! Sd\<tab>d\<tab>d\<tab>d\<tab>d\<tab>d"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 let expect = "d d d d d d"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 " Changing ts should have no effect if vts is in use.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 call cursor(1, 1)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 set ts=6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 exe "norm! Se\<tab>e\<tab>e\<tab>e\<tab>e\<tab>e"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 let expect = "e e e e e e"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 " Clearing vts should revert to using ts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 set vts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 exe "norm! Sf\<tab>f\<tab>f\<tab>f\<tab>f\<tab>f"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 let expect = "f f f f f f"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 " Test variable softtabstops.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 set noet ts=8 vsts=12,2,6
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 exe "norm! Sg\<tab>g\<tab>g\<tab>g\<tab>g\<tab>g"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 let expect = "g\<tab> g g\<tab> g\<tab> g\<tab>g"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 " Variable tabstops and softtabstops combined.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 set vsts=6,12,8 vts=4,6,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 exe "norm! Sh\<tab>h\<tab>h\<tab>h\<tab>h"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 let expect = "h\<tab> h\<tab>\<tab>h\<tab>h\<tab>h"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 " Retab with a single value, not using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 set ts=8 sts=0 vts= vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 exe "norm! Si\<tab>i\<tab>i\<tab>i\<tab>i"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 retab 4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 let expect = "i\<tab>\<tab>i\<tab>\<tab>i\<tab>\<tab>i\<tab>\<tab>i"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 " Retab with a single value, using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 set ts=8 sts=0 vts=6 vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 exe "norm! Sj\<tab>j\<tab>j\<tab>j\<tab>j"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 retab 4
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 let expect = "j\<tab> j\<tab>\<tab>j\<tab> j\<tab>\<tab>j"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 " Retab with multiple values, not using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 set ts=6 sts=0 vts= vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 exe "norm! Sk\<tab>k\<tab>k\<tab>k\<tab>k\<tab>k"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 retab 4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 let expect = "k\<tab> k\<tab>k k\<tab> k\<tab> k"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 " Retab with multiple values, using vts.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 set ts=8 sts=0 vts=6 vsts=
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 exe "norm! Sl\<tab>l\<tab>l\<tab>l\<tab>l\<tab>l"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 retab 4,8
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 let expect = "l\<tab> l\<tab>l l\<tab> l\<tab> l"
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 call assert_equal(expect, getline(1))
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 " Check that global and local values are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 set ts=4 vts=6 sts=8 vsts=10
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 " Check that local values only are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 setlocal ts=5 vts=7 sts=9 vsts=11
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 call assert_equal(&ts, 5)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 call assert_equal(&vts, '7')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 call assert_equal(&sts, 9)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 call assert_equal(&vsts, '11')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 call assert_equal(&ts, 4)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 call assert_equal(&vts, '6')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 call assert_equal(&sts, 8)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 call assert_equal(&vsts, '10')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 " Check that global values only are set.
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 setglobal ts=6 vts=8 sts=10 vsts=12
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 call assert_equal(&ts, 5)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 call assert_equal(&vts, '7')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 call assert_equal(&sts, 9)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 call assert_equal(&vsts, '11')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 new
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 call assert_equal(&ts, 6)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 call assert_equal(&vts, '8')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 call assert_equal(&sts, 10)
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 call assert_equal(&vsts, '12')
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 bwipeout!
2ad722003b36 patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 endfunc
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
264
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
265 func Test_vartabs_linebreak()
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
266 if winwidth(0) < 40
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
267 return
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
268 endif
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
269 new
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
270 40vnew
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
271 %d
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
272 setl linebreak vartabstop=10,20,30,40
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
273 call setline(1, "\tx\tx\tx\tx")
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
274
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
275 let expect = [' x ',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
276 \ 'x x ',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
277 \ 'x ']
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
278 let lines = ScreenLines([1, 3], winwidth(0))
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
279 call s:compare_lines(expect, lines)
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
280 setl list listchars=tab:>-
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
281 let expect = ['>---------x>------------------ ',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
282 \ 'x>------------------x>------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
283 \ 'x ']
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
284 let lines = ScreenLines([1, 3], winwidth(0))
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
285 call s:compare_lines(expect, lines)
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
286 setl linebreak vartabstop=40
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
287 let expect = ['>---------------------------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
288 \ 'x>--------------------------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
289 \ 'x>--------------------------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
290 \ 'x>--------------------------------------',
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
291 \ 'x ']
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
292 let lines = ScreenLines([1, 5], winwidth(0))
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
293 call s:compare_lines(expect, lines)
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
294
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
295 " cleanup
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
296 bw!
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
297 bw!
14218
539b070778b0 patch 8.1.0126: various problems with 'vartabstop'
Christian Brabandt <cb@256bit.org>
parents: 14198
diff changeset
298 set nolist listchars&vim
14198
9ca8c36869ce patch 8.1.0116: display problem with 'vartabstop' and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 14175
diff changeset
299 endfunc
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
300
15062
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
301 func Test_vartabs_shiftwidth()
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
302 "return
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
303 if winwidth(0) < 40
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
304 return
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
305 endif
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
306 new
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
307 40vnew
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
308 %d
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
309 " setl varsofttabstop=10,20,30,40
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
310 setl shiftwidth=0 vartabstop=10,20,30,40
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
311 call setline(1, "x")
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
312
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
313 " Check without any change.
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
314 let expect = ['x ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
315 let lines = ScreenLines(1, winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
316 call s:compare_lines(expect, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
317 " Test 1:
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
318 " shiftwidth depends on the indent, first check with cursor at the end of the
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
319 " line (which is the same as the start of the line, since there is only one
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
320 " character).
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
321 norm! $>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
322 let expect1 = [' x ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
323 let lines = ScreenLines(1, winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
324 call s:compare_lines(expect1, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
325 call assert_equal(10, shiftwidth())
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
326 call assert_equal(10, shiftwidth(1))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
327 call assert_equal(20, shiftwidth(virtcol('.')))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
328 norm! $>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
329 let expect2 = [' x ', '~ ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
330 let lines = ScreenLines([1, 2], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
331 call s:compare_lines(expect2, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
332 call assert_equal(20, shiftwidth(virtcol('.')-2))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
333 call assert_equal(30, shiftwidth(virtcol('.')))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
334 norm! $>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
335 let expect3 = [' ', ' x ', '~ ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
336 let lines = ScreenLines([1, 3], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
337 call s:compare_lines(expect3, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
338 call assert_equal(30, shiftwidth(virtcol('.')-2))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
339 call assert_equal(40, shiftwidth(virtcol('.')))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
340 norm! $>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
341 let expect4 = [' ', ' ', ' x ']
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
342 let lines = ScreenLines([1, 3], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
343 call assert_equal(40, shiftwidth(virtcol('.')))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
344 call s:compare_lines(expect4, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
345
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
346 " Test 2: Put the cursor at the first column, result should be the same
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
347 call setline(1, "x")
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
348 norm! 0>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
349 let lines = ScreenLines(1, winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
350 call s:compare_lines(expect1, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
351 norm! 0>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
352 let lines = ScreenLines([1, 2], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
353 call s:compare_lines(expect2, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
354 norm! 0>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
355 let lines = ScreenLines([1, 3], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
356 call s:compare_lines(expect3, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
357 norm! 0>>
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
358 let lines = ScreenLines([1, 3], winwidth(0))
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
359 call s:compare_lines(expect4, lines)
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
360
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
361 " cleanup
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
362 bw!
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
363 bw!
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
364 endfunc
3a94f7918980 patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents: 14935
diff changeset
365
14935
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
366 func Test_vartabs_failures()
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
367 call assert_fails('set vts=8,')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
368 call assert_fails('set vsts=8,')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
369 call assert_fails('set vts=8,,8')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
370 call assert_fails('set vsts=8,,8')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
371 call assert_fails('set vts=8,,8,')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
372 call assert_fails('set vsts=8,,8,')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
373 call assert_fails('set vts=,8')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
374 call assert_fails('set vsts=,8')
dc54785f9a1d patch 8.1.0479: failure when setting 'varsofttabstop' to end in a comma
Bram Moolenaar <Bram@vim.org>
parents: 14218
diff changeset
375 endfunc
16376
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
376
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
377 func Test_vartabs_reset()
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
378 set vts=8
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
379 set all&
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
380 call assert_equal('', &vts)
3b5d401a58ce patch 8.1.1193: typos and small problems in test files
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
381 endfunc