Bram Moolenaar | b5647f7 | 2014-07-16 17:01:53 +0200 | [diff] [blame] | 1 | Test for linebreak and list option (non-utf8) |
Bram Moolenaar | 86b17e9 | 2014-07-02 20:00:47 +0200 | [diff] [blame] | 2 | |
| 3 | STARTTEST |
| 4 | :so small.vim |
Bram Moolenaar | 404406a | 2014-10-09 13:24:43 +0200 | [diff] [blame] | 5 | :if !exists("+linebreak") || !has("conceal") | e! test.ok | w! test.out | qa! | endif |
Bram Moolenaar | 86b17e9 | 2014-07-02 20:00:47 +0200 | [diff] [blame] | 6 | :10new|:vsp|:vert resize 20 |
Bram Moolenaar | b5647f7 | 2014-07-16 17:01:53 +0200 | [diff] [blame] | 7 | :put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \" |
Bram Moolenaar | 86b17e9 | 2014-07-02 20:00:47 +0200 | [diff] [blame] | 8 | :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 |
| 26 | :let g:test="Test 1: set linebreak" |
| 27 | :redraw! |
| 28 | :let line=ScreenChar(winwidth(0)) |
| 29 | :call DoRecordScreen() |
| 30 | :let g:test="Test 2: set linebreak + set list" |
| 31 | :set linebreak list listchars= |
| 32 | :redraw! |
| 33 | :let line=ScreenChar(winwidth(0)) |
| 34 | :call DoRecordScreen() |
Bram Moolenaar | b5647f7 | 2014-07-16 17:01:53 +0200 | [diff] [blame] | 35 | :let g:test ="Test 3: set linebreak nolist" |
Bram Moolenaar | 86b17e9 | 2014-07-02 20:00:47 +0200 | [diff] [blame] | 36 | :set nolist linebreak |
| 37 | :redraw! |
| 38 | :let line=ScreenChar(winwidth(0)) |
| 39 | :call DoRecordScreen() |
Bram Moolenaar | b5647f7 | 2014-07-16 17:01:53 +0200 | [diff] [blame] | 40 | :let g:test ="Test 4: set linebreak with tab and 1 line as long as screen: should break!" |
Bram Moolenaar | 86b17e9 | 2014-07-02 20:00:47 +0200 | [diff] [blame] | 41 | :set nolist linebreak ts=8 |
| 42 | :let line="1\t".repeat('a', winwidth(0)-2) |
| 43 | :$put =line |
| 44 | :$ |
| 45 | :norm! zt |
| 46 | :redraw! |
| 47 | :let line=ScreenChar(winwidth(0)) |
| 48 | :call DoRecordScreen() |
Bram Moolenaar | 49f9dd7 | 2014-08-29 12:08:43 +0200 | [diff] [blame] | 49 | :let line="_S_\t bla" |
| 50 | :$put =line |
| 51 | :$ |
| 52 | :norm! zt |
| 53 | :let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)" |
| 54 | :set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab |
| 55 | :syn match ConcealVar contained /_/ conceal |
| 56 | :syn match All /.*/ contains=ConcealVar |
| 57 | :let line=ScreenChar(winwidth(0)) |
| 58 | :call DoRecordScreen() |
Bram Moolenaar | 404406a | 2014-10-09 13:24:43 +0200 | [diff] [blame] | 59 | :set cpo&vim linebreak |
| 60 | :let g:test ="Test 6: set linebreak with visual block mode" |
| 61 | :let line="REMOVE: this not" |
Bram Moolenaar | 74db34c | 2015-06-25 13:30:46 +0200 | [diff] [blame] | 62 | :$put =g:test |
Bram Moolenaar | 404406a | 2014-10-09 13:24:43 +0200 | [diff] [blame] | 63 | :$put =line |
| 64 | :let line="REMOVE: aaaaaaaaaaaaa" |
| 65 | :$put =line |
| 66 | :1/^REMOVE: |
| 67 | 0jf x:$put |
Bram Moolenaar | 74db34c | 2015-06-25 13:30:46 +0200 | [diff] [blame] | 68 | :set cpo&vim linebreak |
| 69 | :let g:test ="Test 7: set linebreak with visual block mode and v_b_A" |
| 70 | :$put =g:test |
| 71 | Golong line: 40afoobar aTARGET at end |
| 72 | :exe "norm! $3B\<C-v>eAx\<Esc>" |
| 73 | :set cpo&vim linebreak sbr= |
| 74 | :let g:test ="Test 8: set linebreak with visual char mode and changing block" |
| 75 | :$put =g:test |
| 76 | Go1111-1111-1111-11-1111-1111-11110f-lv3lc2222bgj. |
Bram Moolenaar | 31b259b | 2015-07-28 11:21:32 +0200 | [diff] [blame] | 77 | :let g:test ="Test 9: using redo after block visual mode" |
| 78 | :$put =g:test |
| 79 | Go |
| 80 | aaa |
| 81 | aaa |
| 82 | a2k2j~e. |
Bram Moolenaar | 89c17c0 | 2015-08-11 17:46:36 +0200 | [diff] [blame^] | 83 | :let g:test ="Test 10: using normal commands after block-visual" |
| 84 | :$put =g:test |
| 85 | :set linebreak |
| 86 | Go |
| 87 | abcd{ef |
| 88 | ghijklm |
| 89 | no}pqrs2k0f{c% |
Bram Moolenaar | 86b17e9 | 2014-07-02 20:00:47 +0200 | [diff] [blame] | 90 | :%w! test.out |
| 91 | :qa! |
| 92 | ENDTEST |
| 93 | dummy text |