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
|
|
9 :fu! ScreenChar(width)
|
|
10 : let c=''
|
|
11 : for i in range(1,a:width)
|
|
12 : let c.=nr2char(screenchar(line('.'), i))
|
|
13 : endfor
|
|
14 : let c.="\n"
|
|
15 : for i in range(1,a:width)
|
|
16 : let c.=nr2char(screenchar(line('.')+1, i))
|
|
17 : endfor
|
|
18 : let c.="\n"
|
|
19 : for i in range(1,a:width)
|
|
20 : let c.=nr2char(screenchar(line('.')+2, i))
|
|
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
|
|
30 :let g:test="Test 1: Simple breakindent"
|
|
31 :let line1=ScreenChar(8)
|
|
32 :call DoRecordScreen()
|
|
33 :let g:test="Test 2: Simple breakindent + sbr=>>"
|
|
34 :set sbr=>>
|
|
35 :let line1=ScreenChar(8)
|
|
36 :call DoRecordScreen()
|
|
37 :let g:test ="Test 3: Simple breakindent + briopt:sbr"
|
|
38 :set briopt=sbr,min:0 sbr=++
|
|
39 :let line1=ScreenChar(8)
|
|
40 :call DoRecordScreen()
|
|
41 :let g:test ="Test 4: Simple breakindent + min width: 18"
|
|
42 :set sbr= briopt=min:18
|
|
43 :let line1=ScreenChar(8)
|
|
44 :call DoRecordScreen()
|
|
45 :let g:test =" Test 5: Simple breakindent + shift by 2"
|
|
46 :set briopt=shift:2,min:0
|
|
47 :let line1=ScreenChar(8)
|
|
48 :call DoRecordScreen()
|
|
49 :let g:test=" Test 6: Simple breakindent + shift by -1"
|
|
50 :set briopt=shift:-1,min:0
|
|
51 :let line1=ScreenChar(8)
|
|
52 :call DoRecordScreen()
|
|
53 :let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr"
|
|
54 :set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4
|
|
55 :let line1=ScreenChar(10)
|
|
56 :call DoRecordScreen()
|
|
57 :let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr"
|
|
58 :set briopt=shift:1,sbr,min:0 nu sbr=# list
|
|
59 :let line1=ScreenChar(10)
|
|
60 :call DoRecordScreen()
|
|
61 :let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list"
|
|
62 :set briopt-=sbr
|
|
63 :let line1=ScreenChar(10)
|
|
64 :call DoRecordScreen()
|
|
65 :let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n"
|
|
66 :set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0
|
|
67 :let line1=ScreenChar(10)
|
|
68 :call DoRecordScreen()
|
|
69 :wincmd p
|
|
70 :let g:test="\n Test 11: strdisplaywidth when breakindent is on"
|
|
71 :set cpo-=n sbr=>> nu nuw=4 nolist briopt= ts=4
|
|
72 :let text=getline(2) "skip leading tab when calculating text width
|
|
73 :let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times
|
|
74 :$put =g:test
|
|
75 :$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width)
|
|
76 :%w! test.out
|
|
77 :qa!
|
|
78 ENDTEST
|
|
79 dummy text
|