annotate src/testdir/test_breakindent.in @ 9640:bc0a6d9a9a07 v7.4.2097

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