blob: d51b2f9a5d820cd75d86ef9c25e1066e7fefb60b [file] [log] [blame]
Bram Moolenaarb5647f72014-07-16 17:01:53 +02001Test for linebreak and list option (non-utf8)
Bram Moolenaar86b17e92014-07-02 20:00:47 +02002
3STARTTEST
4:so small.vim
Bram Moolenaar404406a2014-10-09 13:24:43 +02005:if !exists("+linebreak") || !has("conceal") | e! test.ok | w! test.out | qa! | endif
Bram Moolenaar86b17e92014-07-02 20:00:47 +02006:10new|:vsp|:vert resize 20
Bram Moolenaarb5647f72014-07-16 17:01:53 +02007:put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \"
Bram Moolenaar86b17e92014-07-02 20:00:47 +02008:norm! zt
9:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
10:fu! ScreenChar(width)
11: let c=''
12: for j in range(1,4)
13: for i in range(1,a:width)
14: let c.=nr2char(screenchar(j, i))
15: endfor
16: let c.="\n"
17: endfor
18: return c
19:endfu
20:fu! DoRecordScreen()
21: wincmd l
22: $put =printf(\"\n%s\", g:test)
23: $put =g:line
24: wincmd p
25:endfu
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010026:"
Bram Moolenaar86b17e92014-07-02 20:00:47 +020027:let g:test="Test 1: set linebreak"
28:redraw!
29:let line=ScreenChar(winwidth(0))
30:call DoRecordScreen()
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010031:"
Bram Moolenaar86b17e92014-07-02 20:00:47 +020032:let g:test="Test 2: set linebreak + set list"
33:set linebreak list listchars=
34:redraw!
35:let line=ScreenChar(winwidth(0))
36:call DoRecordScreen()
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010037:"
Bram Moolenaarb5647f72014-07-16 17:01:53 +020038:let g:test ="Test 3: set linebreak nolist"
Bram Moolenaar86b17e92014-07-02 20:00:47 +020039:set nolist linebreak
40:redraw!
41:let line=ScreenChar(winwidth(0))
42:call DoRecordScreen()
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010043:"
Bram Moolenaarb5647f72014-07-16 17:01:53 +020044:let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!"
Bram Moolenaar86b17e92014-07-02 20:00:47 +020045:set nolist linebreak ts=8
46:let line="1\t".repeat('a', winwidth(0)-2)
47:$put =line
48:$
49:norm! zt
50:redraw!
51:let line=ScreenChar(winwidth(0))
52:call DoRecordScreen()
Bram Moolenaar49f9dd72014-08-29 12:08:43 +020053:let line="_S_\t bla"
54:$put =line
55:$
56:norm! zt
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010057:"
Bram Moolenaar49f9dd72014-08-29 12:08:43 +020058:let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)"
59:set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab
60:syn match ConcealVar contained /_/ conceal
61:syn match All /.*/ contains=ConcealVar
62:let line=ScreenChar(winwidth(0))
63:call DoRecordScreen()
Bram Moolenaar404406a2014-10-09 13:24:43 +020064:set cpo&vim linebreak
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010065:"
Bram Moolenaar404406a2014-10-09 13:24:43 +020066:let g:test ="Test 6: set linebreak with visual block mode"
67:let line="REMOVE: this not"
Bram Moolenaar74db34c2015-06-25 13:30:46 +020068:$put =g:test
Bram Moolenaar404406a2014-10-09 13:24:43 +020069:$put =line
70:let line="REMOVE: aaaaaaaaaaaaa"
71:$put =line
72:1/^REMOVE:
730jf x:$put
Bram Moolenaar74db34c2015-06-25 13:30:46 +020074:set cpo&vim linebreak
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010075:"
Bram Moolenaar74db34c2015-06-25 13:30:46 +020076:let g:test ="Test 7: set linebreak with visual block mode and v_b_A"
77:$put =g:test
78Golong line: 40afoobar aTARGET at end
79:exe "norm! $3B\<C-v>eAx\<Esc>"
80:set cpo&vim linebreak sbr=
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010081:"
Bram Moolenaar74db34c2015-06-25 13:30:46 +020082:let g:test ="Test 8: set linebreak with visual char mode and changing block"
83:$put =g:test
84Go1111-1111-1111-11-1111-1111-11110f-lv3lc2222bgj.
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010085:"
Bram Moolenaar31b259b2015-07-28 11:21:32 +020086:let g:test ="Test 9: using redo after block visual mode"
87:$put =g:test
88Go
89aaa
90aaa
91a2k2j~e.
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +010092:"
Bram Moolenaar89c17c02015-08-11 17:46:36 +020093:let g:test ="Test 10: using normal commands after block-visual"
94:$put =g:test
95:set linebreak
96Go
97abcd{ef
98ghijklm
99no}pqrs2k0f{c%
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +0100100:"
Bram Moolenaar10ad1d92015-09-25 19:35:02 +0200101:let g:test ="Test 11: using block replace mode after wrapping"
102:$put =g:test
103:set linebreak wrap
104Go150aayypk147|jr0
Bram Moolenaar9bc01eb2015-12-17 21:14:58 +0100105:"
106:let g:test ="Test 12: set linebreak list listchars=space:_,tab:>-,tail:-,eol:$"
107:set list listchars=space:_,trail:-,tab:>-,eol:$
108:$put =g:test
109:let line="a aaaaaaaaaaaaaaaaaaaaaa\ta "
110:$put =line
111:$
112:norm! zt
113:redraw!
114:let line=ScreenChar(winwidth(0))
115:call DoRecordScreen()
Bram Moolenaar86b17e92014-07-02 20:00:47 +0200116:%w! test.out
117:qa!
118ENDTEST
119dummy text