annotate src/testdir/test_listlbr.vim @ 21387:8d58cbb07a12 v8.2.1244

patch 8.2.1244: Vim9: in lambda index assumes a list Commit: https://github.com/vim/vim/commit/6802cce407b8b181bcf3eafe701fa9f8a91f7a73 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 19 15:49:49 2020 +0200 patch 8.2.1244: Vim9: in lambda index assumes a list Problem: Vim9: in lambda index assumes a list. Solution: Use the value type to decide about list or dict. (closes https://github.com/vim/vim/issues/6479)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jul 2020 16:00:04 +0200
parents be81baeb69f8
children 08940efa6b4e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test for linebreak and list option (non-utf8)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 set encoding=latin1
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 scriptencoding latin1
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
6 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
7 CheckOption linebreak
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
8 CheckFeature conceal
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 source view_util.vim
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 function s:screen_lines(lnum, width) abort
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 return ScreenLines(a:lnum, a:width)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endfunction
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11010
diff changeset
16 func s:compare_lines(expect, actual)
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 11010
diff changeset
18 endfunc
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 function s:test_windows(...)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call NewWindow(10, 20)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 setl ts=8 sw=4 sts=4 linebreak sbr= wrap
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 exe get(a:000, 0, '')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 endfunction
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 function s:close_windows(...)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call CloseWindow()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 exe get(a:000, 0, '')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 endfunction
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 func Test_set_linebreak()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call s:test_windows('setl ts=4 sbr=+')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ " abcdef ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ "+hijklmn ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ "+pqrstuvwxyz_1060ABC",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 \ "+DEFGHIJKLMNOP ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 func Test_linebreak_with_list()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call s:test_windows('setl ts=4 sbr=+ list listchars=')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 \ "^Iabcdef hijklmn^I ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 \ "+pqrstuvwxyz_1060ABC",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 \ "+DEFGHIJKLMNOP ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 func Test_linebreak_with_nolist()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 call s:test_windows('setl ts=4 sbr=+ nolist')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 call setline(1, "\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP ")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 \ " abcdef ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 \ "+hijklmn ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 \ "+pqrstuvwxyz_1060ABC",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 \ "+DEFGHIJKLMNOP ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 func Test_should_break()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call s:test_windows('setl sbr=+ nolist')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call setline(1, "1\t" . repeat('a', winwidth(0)-2))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 \ "1 ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 \ "+aaaaaaaaaaaaaaaaaa ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 func Test_linebreak_with_conceal()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 call s:test_windows('setl cpo&vim sbr=+ list conceallevel=2 concealcursor=nv listchars=tab:ab')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 call setline(1, "_S_\t bla")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 syn match ConcealVar contained /_/ conceal
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 syn match All /.*/ contains=ConcealVar
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 \ "Sabbbbbb bla ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
19176
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
103 func Test_linebreak_with_visual_operations()
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
104 call s:test_windows()
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
105 let line = '1234567890 2234567890 3234567890'
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
106 call setline(1, line)
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
107
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
108 " yank
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
109 exec "norm! ^w\<C-V>ey"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
110 call assert_equal('2234567890', @@)
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
111 exec "norm! w\<C-V>ey"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
112 call assert_equal('3234567890', @@)
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
113
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
114 " increment / decrement
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
115 exec "norm! ^w\<C-V>\<C-A>w\<C-V>\<C-X>"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
116 call assert_equal('1234567890 3234567890 2234567890', getline(1))
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
117
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
118 " replace
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
119 exec "norm! ^w\<C-V>3lraw\<C-V>3lrb"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
120 call assert_equal('1234567890 aaaa567890 bbbb567890', getline(1))
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
121
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
122 " tilde
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
123 exec "norm! ^w\<C-V>2l~w\<C-V>2l~"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
124 call assert_equal('1234567890 AAAa567890 BBBb567890', getline(1))
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
125
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
126 " delete and insert
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
127 exec "norm! ^w\<C-V>3lc2345\<Esc>w\<C-V>3lc3456\<Esc>"
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
128 call assert_equal('1234567890 2345567890 3456567890', getline(1))
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
129 call assert_equal('BBBb', @@)
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
130
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
131 call s:close_windows()
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
132 endfunc
be81baeb69f8 patch 8.2.0147: block Visual mode operators not correct when 'linebreak' set
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
133
10843
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 func Test_virtual_block()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 call s:test_windows('setl sbr=+')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 call setline(1, [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 \ "REMOVE: this not",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 \ "REMOVE: aaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 \ ])
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 exe "norm! 1/^REMOVE:"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 exe "norm! 0\<C-V>jf x"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 $put
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 let lines = s:screen_lines([1, 4], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 \ "this not ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 \ "aaaaaaaaaaaaa ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 \ "REMOVE: ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 \ "REMOVE: ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 func Test_virtual_block_and_vbA()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 call setline(1, "long line: " . repeat("foobar ", 40) . "TARGET at end")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 exe "norm! $3B\<C-v>eAx\<Esc>"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 let lines = s:screen_lines([1, 10], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 \ "foobar foobar ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 \ "foobar TARGETx at ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 func Test_virtual_char_and_block()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 call setline(1, "1111-1111-1111-11-1111-1111-1111")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 exe "norm! 0f-lv3lc2222\<Esc>bgj."
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 let lines = s:screen_lines([1, 2], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 \ "1111-2222-1111-11- ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 \ "1111-2222-1111 ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 func Test_undo_after_block_visual()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 call setline(1, ["aaa", "aaa", "a"])
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 exe "norm! gg\<C-V>2j~e."
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 let lines = s:screen_lines([1, 3], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 \ "AaA ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 \ "AaA ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 \ "A ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 func Test_norm_after_block_visual()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 call setline(1, ["abcd{ef", "ghijklm", "no}pgrs"])
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 exe "norm! ggf{\<C-V>\<C-V>c%"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 let lines = s:screen_lines([1, 3], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 \ "abcdpgrs ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 \ "~ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 func Test_block_replace_after_wrapping()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 call s:test_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 call setline(1, repeat("a", 150))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 exe "norm! 0yypk147|\<C-V>jr0"
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 call assert_equal(repeat("a", 146) . "0aaa", getline(1))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 call assert_equal(repeat("a", 146) . "0aaa", getline(2))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 let lines = s:screen_lines([1, 10], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 \ "aaaaaa0aaa ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 \ "@ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 \ "@ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 endfunc
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 func Test_list_with_listchars()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 call s:test_windows('setl list listchars=space:_,trail:-,tab:>-,eol:$')
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 call setline(1, "a aaaaaaaaaaaaaaaaaaaaaa\ta ")
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 let lines = s:screen_lines([1, 3], winwidth(0))
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 let expect = [
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 \ "a_ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 \ "aaaaaaaaaaaaaaaaaaaa",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 \ "aa>-----a-$ ",
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 \ ]
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 call s:compare_lines(expect, lines)
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 call s:close_windows()
678edb254216 patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 endfunc
11010
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
251
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
252 func Test_list_with_tab_and_skipping_first_chars()
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
253 call s:test_windows('setl list listchars=tab:>- ts=70 nowrap')
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
254 call setline(1, ["iiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa", "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\taaaaaaaaaaaaaaaaaa"])
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
255 call cursor(4,64)
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
256 norm! 2zl
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
257 let lines = s:screen_lines([1, 4], winwidth(0))
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
258 let expect = [
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
259 \ "---------------aaaaa",
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
260 \ "---------------aaaaa",
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
261 \ "---------------aaaaa",
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
262 \ "iiiiiiiii>-----aaaaa",
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
263 \ ]
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
264 call s:compare_lines(expect, lines)
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
265 call s:close_windows()
c004e17fa36b patch 8.0.0394: tabs are not aligned when scrolling horizontally
Christian Brabandt <cb@256bit.org>
parents: 10843
diff changeset
266 endfu