5995
|
1 Test for breakindent
|
|
2
|
|
3 STARTTEST
|
|
4 :so small.vim
|
|
5 :if !exists("+breakindent") | e! test.ok | w! test.out | qa! | endif
|
|
6 :10new|:vsp|:vert resize 20
|
|
7 :put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\"
|
|
8 :set ts=4 sw=4 sts=4 breakindent
|
6396
|
9 :fu! ScreenChar(line, width)
|
5995
|
10 : let c=''
|
|
11 : for i in range(1,a:width)
|
6396
|
12 : let c.=nr2char(screenchar(a:line, i))
|
5995
|
13 : endfor
|
|
14 : let c.="\n"
|
|
15 : for i in range(1,a:width)
|
6396
|
16 : let c.=nr2char(screenchar(a:line+1, i))
|
5995
|
17 : endfor
|
|
18 : let c.="\n"
|
|
19 : for i in range(1,a:width)
|
6396
|
20 : let c.=nr2char(screenchar(a:line+2, i))
|
5995
|
21 : endfor
|
|
22 : return c
|
|
23 :endfu
|
|
24 :fu DoRecordScreen()
|
|
25 : wincmd l
|
|
26 : $put =printf(\"\n%s\", g:test)
|
|
27 : $put =g:line1
|
|
28 : wincmd p
|
|
29 :endfu
|
6162
|
30 :set briopt=min:0
|
5995
|
31 :let g:test="Test 1: Simple breakindent"
|
6396
|
32 :let line1=ScreenChar(line('.'),8)
|
5995
|
33 :call DoRecordScreen()
|
|
34 :let g:test="Test 2: Simple breakindent + sbr=>>"
|
|
35 :set sbr=>>
|
6396
|
36 :let line1=ScreenChar(line('.'),8)
|
5995
|
37 :call DoRecordScreen()
|
|
38 :let g:test ="Test 3: Simple breakindent + briopt:sbr"
|
|
39 :set briopt=sbr,min:0 sbr=++
|
6396
|
40 :let line1=ScreenChar(line('.'),8)
|
5995
|
41 :call DoRecordScreen()
|
|
42 :let g:test ="Test 4: Simple breakindent + min width: 18"
|
|
43 :set sbr= briopt=min:18
|
6396
|
44 :let line1=ScreenChar(line('.'),8)
|
5995
|
45 :call DoRecordScreen()
|
|
46 :let g:test =" Test 5: Simple breakindent + shift by 2"
|
|
47 :set briopt=shift:2,min:0
|
6396
|
48 :let line1=ScreenChar(line('.'),8)
|
5995
|
49 :call DoRecordScreen()
|
|
50 :let g:test=" Test 6: Simple breakindent + shift by -1"
|
|
51 :set briopt=shift:-1,min:0
|
6396
|
52 :let line1=ScreenChar(line('.'),8)
|
5995
|
53 :call DoRecordScreen()
|
|
54 :let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"
|
|
55 :set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4
|
6396
|
56 :let line1=ScreenChar(line('.'),10)
|
5995
|
57 :call DoRecordScreen()
|
|
58 :let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"
|
|
59 :set briopt=shift:1,sbr,min:0 nu sbr=# list
|
6396
|
60 :let line1=ScreenChar(line('.'),10)
|
5995
|
61 :call DoRecordScreen()
|
|
62 :let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"
|
|
63 :set briopt-=sbr
|
6396
|
64 :let line1=ScreenChar(line('.'),10)
|
5995
|
65 :call DoRecordScreen()
|
|
66 :let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"
|
|
67 :set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0
|
6396
|
68 :let line1=ScreenChar(line('.'),10)
|
5995
|
69 :call DoRecordScreen()
|
|
70 :wincmd p
|
|
71 :let g:test="\n Test 11: strdisplaywidth when breakindent is on"
|
|
72 :set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4
|
|
73 :let text=getline(2) "skip leading tab when calculating text width
|
|
74 :let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times
|
|
75 :$put =g:test
|
|
76 :$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)
|
6396
|
77 :let g:str="\t\t\t\t\t{"
|
|
78 :let g:test=" Test 12: breakindent + long indent"
|
|
79 :wincmd p
|
|
80 :set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4
|
|
81 :$put =g:str
|
|
82 zt:let line1=ScreenChar(1,10)
|
|
83 :wincmd p
|
|
84 :call DoRecordScreen()
|
6160
|
85 :"
|
|
86 :" Test, that the string " a\tb\tc\td\te" is correctly
|
|
87 :" displayed in a 20 column wide window (see bug report
|
|
88 :" https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ
|
|
89 :only
|
|
90 :vert 20new
|
|
91 :set all& nocp breakindent briopt=min:10
|
|
92 :call setline(1, [" a\tb\tc\td\te", " z y x w v"])
|
|
93 :/^\s*a
|
|
94 fbgjyl:let line1 = @0
|
|
95 :?^\s*z
|
|
96 fygjyl:let line2 = @0
|
|
97 :quit!
|
6396
|
98 :$put ='Test 13: breakindent with wrapping Tab'
|
6160
|
99 :$put =line1
|
|
100 :$put =line2
|
|
101 :"
|
6535
|
102 :let g:test="Test 14: breakindent + visual blockwise delete #1"
|
6555
|
103 :set all& breakindent viminfo+=nviminfo
|
6535
|
104 :30vnew
|
|
105 :normal! 3a1234567890
|
|
106 :normal! a abcde
|
|
107 :exec "normal! 0\<C-V>tex"
|
|
108 :let line1=ScreenChar(line('.'),8)
|
|
109 :call DoRecordScreen()
|
|
110 :"
|
|
111 :let g:test="Test 15: breakindent + visual blockwise delete #2"
|
|
112 :%d
|
|
113 :normal! 4a1234567890
|
|
114 :exec "normal! >>\<C-V>3f0x"
|
|
115 :let line1=ScreenChar(line('.'),20)
|
|
116 :call DoRecordScreen()
|
|
117 :quit!
|
|
118 :"
|
5995
|
119 :%w! test.out
|
|
120 :qa!
|
|
121 ENDTEST
|
|
122 dummy text
|