6062
|
1 Test for linebreak and list option in utf-8 mode
|
|
2
|
|
3 STARTTEST
|
|
4 :so small.vim
|
6528
|
5 :if !exists("+linebreak") || !has("conceal") | e! test.ok | w! test.out | qa! | endif
|
6062
|
6 :so mbyte.vim
|
|
7 :if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif
|
|
8 :10new|:vsp|:vert resize 20
|
|
9 :put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \"
|
|
10 :norm! zt
|
|
11 :set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
|
6520
|
12 :fu! ScreenChar(width, lines)
|
6062
|
13 : let c=''
|
6520
|
14 : for j in range(1,a:lines)
|
6062
|
15 : for i in range(1,a:width)
|
|
16 : let c.=nr2char(screenchar(j, i))
|
|
17 : endfor
|
|
18 : let c.="\n"
|
|
19 : endfor
|
|
20 : return c
|
|
21 :endfu
|
|
22 :fu! DoRecordScreen()
|
|
23 : wincmd l
|
|
24 : $put =printf(\"\n%s\", g:test)
|
|
25 : $put =g:line
|
|
26 : wincmd p
|
|
27 :endfu
|
|
28 :let g:test ="Test 1: set linebreak + set list + fancy listchars"
|
|
29 :exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
|
|
30 :redraw!
|
6520
|
31 :let line=ScreenChar(winwidth(0),4)
|
6062
|
32 :call DoRecordScreen()
|
6100
|
33 :"
|
6062
|
34 :let g:test ="Test 2: set nolinebreak list"
|
|
35 :set list nolinebreak
|
|
36 :redraw!
|
6520
|
37 :let line=ScreenChar(winwidth(0),4)
|
6062
|
38 :call DoRecordScreen()
|
6100
|
39 :"
|
|
40 :let g:test ="Test 3: set linebreak nolist"
|
|
41 :$put =\"\t*mask = nil;\"
|
|
42 :$
|
|
43 :norm! zt
|
|
44 :set nolist linebreak
|
|
45 :redraw!
|
6520
|
46 :let line=ScreenChar(winwidth(0),4)
|
6100
|
47 :call DoRecordScreen()
|
6520
|
48 :let g:test ="Test 4: set linebreak list listchars and concealing"
|
|
49 :let c_defines=['#define ABCDE 1','#define ABCDEF 1','#define ABCDEFG 1','#define ABCDEFGH 1', '#define MSG_MODE_FILE 1','#define MSG_MODE_CONSOLE 2','#define MSG_MODE_FILE_AND_CONSOLE 3','#define MSG_MODE_FILE_THEN_CONSOLE 4']
|
|
50 :call append('$', c_defines)
|
|
51 :vert resize 40
|
|
52 :$-7
|
|
53 :norm! zt
|
|
54 :set list linebreak listchars=tab:>- cole=1
|
|
55 :syn match Conceal conceal cchar=>'AB\|MSG_MODE'
|
|
56 :redraw!
|
|
57 :let line=ScreenChar(winwidth(0),7)
|
|
58 :call DoRecordScreen()
|
6627
|
59 :let g:test ="Test 5: set linebreak list listchars and concealing part2"
|
|
60 :let c_defines=['bbeeeeee ; some text']
|
|
61 :call append('$', c_defines)
|
|
62 :$
|
|
63 :norm! zt
|
|
64 :set nowrap ts=2 list linebreak listchars=tab:>- cole=2 concealcursor=n
|
|
65 :syn clear
|
|
66 :syn match meaning /;\s*\zs.*/
|
|
67 :syn match hasword /^\x\{8}/ contains=word
|
|
68 :syn match word /\<\x\{8}\>/ contains=beginword,endword contained
|
|
69 :syn match beginword /\<\x\x/ contained conceal
|
|
70 :syn match endword /\x\{6}\>/ contained
|
|
71 :hi meaning guibg=blue
|
|
72 :hi beginword guibg=green
|
|
73 :hi endword guibg=red
|
|
74 :redraw!
|
|
75 :let line=ScreenChar(winwidth(0),1)
|
|
76 :call DoRecordScreen()
|
|
77 :let g:test ="Test 6: Screenattributes for comment"
|
|
78 :$put =g:test
|
|
79 :call append('$', ' /* and some more */')
|
|
80 :exe "set ft=c ts=7 linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
|
|
81 :syntax on
|
|
82 :hi SpecialKey term=underline ctermfg=red guifg=red
|
|
83 :let attr=[]
|
|
84 :nnoremap <expr> GG ":let attr += ['".screenattr(screenrow(),screencol())."']\n"
|
|
85 :$
|
|
86 :norm! zt0
|
|
87 GGlGGlGGlGGlGGlGGlGGlGGlGGlGGl
|
|
88 :call append('$', ['ScreenAttributes for test6:'])
|
|
89 :if attr[0] != attr[1] && attr[1] != attr[3] && attr[3] != attr[5]
|
|
90 : call append('$', "Attribut 0 and 1 and 3 and 5 are different!")
|
|
91 :else
|
|
92 : call append('$', "Not all attributes are different")
|
|
93 :endif
|
6062
|
94 :%w! test.out
|
|
95 :qa!
|
|
96 ENDTEST
|
|
97 dummy text
|