blob: 6f75521220c0c21b96463c98b84a7aec9d1ae049 [file] [log] [blame]
Bram Moolenaar98aefe72018-12-13 22:20:09 +01001" Tests for defining text property types and adding text properties to the
2" buffer.
3
4if !has('textprop')
5 finish
6endif
7
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +01008source screendump.vim
9
Bram Moolenaarb9c67a52019-01-01 19:49:20 +010010" test length zero
11
Bram Moolenaar98aefe72018-12-13 22:20:09 +010012func Test_proptype_global()
13 call prop_type_add('comment', {'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
14 let proptypes = prop_type_list()
15 call assert_equal(1, len(proptypes))
16 call assert_equal('comment', proptypes[0])
17
18 let proptype = prop_type_get('comment')
19 call assert_equal('Directory', proptype['highlight'])
20 call assert_equal(123, proptype['priority'])
21 call assert_equal(1, proptype['start_incl'])
22 call assert_equal(1, proptype['end_incl'])
23
24 call prop_type_delete('comment')
25 call assert_equal(0, len(prop_type_list()))
26
27 call prop_type_add('one', {})
28 call assert_equal(1, len(prop_type_list()))
29 let proptype = prop_type_get('one')
30 call assert_false(has_key(proptype, 'highlight'))
31 call assert_equal(0, proptype['priority'])
32 call assert_equal(0, proptype['start_incl'])
33 call assert_equal(0, proptype['end_incl'])
34
35 call prop_type_add('two', {})
36 call assert_equal(2, len(prop_type_list()))
37 call prop_type_delete('one')
38 call assert_equal(1, len(prop_type_list()))
39 call prop_type_delete('two')
40 call assert_equal(0, len(prop_type_list()))
41endfunc
42
43func Test_proptype_buf()
44 let bufnr = bufnr('')
45 call prop_type_add('comment', {'bufnr': bufnr, 'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
46 let proptypes = prop_type_list({'bufnr': bufnr})
47 call assert_equal(1, len(proptypes))
48 call assert_equal('comment', proptypes[0])
49
50 let proptype = prop_type_get('comment', {'bufnr': bufnr})
51 call assert_equal('Directory', proptype['highlight'])
52 call assert_equal(123, proptype['priority'])
53 call assert_equal(1, proptype['start_incl'])
54 call assert_equal(1, proptype['end_incl'])
55
56 call prop_type_delete('comment', {'bufnr': bufnr})
57 call assert_equal(0, len(prop_type_list({'bufnr': bufnr})))
58
59 call prop_type_add('one', {'bufnr': bufnr})
60 let proptype = prop_type_get('one', {'bufnr': bufnr})
61 call assert_false(has_key(proptype, 'highlight'))
62 call assert_equal(0, proptype['priority'])
63 call assert_equal(0, proptype['start_incl'])
64 call assert_equal(0, proptype['end_incl'])
65
66 call prop_type_add('two', {'bufnr': bufnr})
67 call assert_equal(2, len(prop_type_list({'bufnr': bufnr})))
68 call prop_type_delete('one', {'bufnr': bufnr})
69 call assert_equal(1, len(prop_type_list({'bufnr': bufnr})))
70 call prop_type_delete('two', {'bufnr': bufnr})
71 call assert_equal(0, len(prop_type_list({'bufnr': bufnr})))
72endfunc
73
74func AddPropTypes()
75 call prop_type_add('one', {})
76 call prop_type_add('two', {})
77 call prop_type_add('three', {})
78 call prop_type_add('whole', {})
79endfunc
80
81func DeletePropTypes()
82 call prop_type_delete('one')
83 call prop_type_delete('two')
84 call prop_type_delete('three')
85 call prop_type_delete('whole')
86endfunc
87
88func SetupPropsInFirstLine()
89 call setline(1, 'one two three')
90 call prop_add(1, 1, {'length': 3, 'id': 11, 'type': 'one'})
91 call prop_add(1, 5, {'length': 3, 'id': 12, 'type': 'two'})
Bram Moolenaar4164bb22019-01-04 23:09:49 +010092 call prop_add(1, 9, {'length': 5, 'id': 13, 'type': 'three'})
Bram Moolenaar98aefe72018-12-13 22:20:09 +010093 call prop_add(1, 1, {'length': 13, 'id': 14, 'type': 'whole'})
94endfunc
95
Bram Moolenaar4164bb22019-01-04 23:09:49 +010096func Get_expected_props()
97 return [
98 \ {'col': 1, 'length': 13, 'id': 14, 'type': 'whole', 'start': 1, 'end': 1},
Bram Moolenaar98aefe72018-12-13 22:20:09 +010099 \ {'col': 1, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
100 \ {'col': 5, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100101 \ {'col': 9, 'length': 5, 'id': 13, 'type': 'three', 'start': 1, 'end': 1},
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100102 \ ]
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100103endfunc
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100104
105func Test_prop_add()
106 new
107 call AddPropTypes()
108 call SetupPropsInFirstLine()
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100109 let expected_props = Get_expected_props()
110 call assert_equal(expected_props, prop_list(1))
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100111 call assert_fails("call prop_add(10, 1, {'length': 1, 'id': 14, 'type': 'whole'})", 'E966:')
112 call assert_fails("call prop_add(1, 22, {'length': 1, 'id': 14, 'type': 'whole'})", 'E964:')
113
114 " Insert a line above, text props must still be there.
115 call append(0, 'empty')
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100116 call assert_equal(expected_props, prop_list(2))
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100117 " Delete a line above, text props must still be there.
118 1del
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100119 call assert_equal(expected_props, prop_list(1))
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100120
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100121 " Prop without length or end column is zero length
122 call prop_clear(1)
123 call prop_add(1, 5, {'type': 'two'})
124 let expected = [{'col': 5, 'length': 0, 'type': 'two', 'id': 0, 'start': 1, 'end': 1}]
125 call assert_equal(expected, prop_list(1))
126
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100127 call DeletePropTypes()
128 bwipe!
129endfunc
130
131func Test_prop_remove()
132 new
133 call AddPropTypes()
134 call SetupPropsInFirstLine()
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100135 let props = Get_expected_props()
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100136 call assert_equal(props, prop_list(1))
137
138 " remove by id
139 call prop_remove({'id': 12}, 1)
140 unlet props[2]
141 call assert_equal(props, prop_list(1))
142
143 " remove by type
144 call prop_remove({'type': 'one'}, 1)
145 unlet props[1]
146 call assert_equal(props, prop_list(1))
147
148 call DeletePropTypes()
149 bwipe!
150endfunc
151
Bram Moolenaar196d1572019-01-02 23:47:18 +0100152func SetupOneLine()
153 call setline(1, 'xonex xtwoxx')
154 call AddPropTypes()
155 call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'})
156 call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'})
157 let expected = [
158 \ {'col': 2, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
159 \ {'col': 8, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
160 \]
161 call assert_equal(expected, prop_list(1))
162 return expected
163endfunc
164
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100165func Test_prop_add_remove_buf()
166 new
167 let bufnr = bufnr('')
168 call AddPropTypes()
169 call setline(1, 'one two three')
170 wincmd w
171 call prop_add(1, 1, {'length': 3, 'id': 11, 'type': 'one', 'bufnr': bufnr})
172 call prop_add(1, 5, {'length': 3, 'id': 12, 'type': 'two', 'bufnr': bufnr})
173 call prop_add(1, 11, {'length': 3, 'id': 13, 'type': 'three', 'bufnr': bufnr})
174
175 let props = [
176 \ {'col': 1, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
177 \ {'col': 5, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
178 \ {'col': 11, 'length': 3, 'id': 13, 'type': 'three', 'start': 1, 'end': 1},
179 \]
180 call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
181
182 " remove by id
183 call prop_remove({'id': 12, 'bufnr': bufnr}, 1)
184 unlet props[1]
185 call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
186
187 " remove by type
188 call prop_remove({'type': 'one', 'bufnr': bufnr}, 1)
189 unlet props[0]
190 call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
191
192 call DeletePropTypes()
193 wincmd w
194 bwipe!
195endfunc
196
Bram Moolenaar33c8ca92019-01-02 18:00:27 +0100197func Test_prop_backspace()
198 new
199 set bs=2
Bram Moolenaar196d1572019-01-02 23:47:18 +0100200 let expected = SetupOneLine() " 'xonex xtwoxx'
Bram Moolenaar33c8ca92019-01-02 18:00:27 +0100201
202 exe "normal 0li\<BS>\<Esc>fxli\<BS>\<Esc>"
203 call assert_equal('one xtwoxx', getline(1))
204 let expected[0].col = 1
205 let expected[1].col = 6
206 call assert_equal(expected, prop_list(1))
207
208 call DeletePropTypes()
209 bwipe!
210 set bs&
211endfunc
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100212
Bram Moolenaar196d1572019-01-02 23:47:18 +0100213func Test_prop_replace()
214 new
215 set bs=2
216 let expected = SetupOneLine() " 'xonex xtwoxx'
217
218 exe "normal 0Ryyy\<Esc>"
219 call assert_equal('yyyex xtwoxx', getline(1))
220 call assert_equal(expected, prop_list(1))
221
222 exe "normal ftRyy\<BS>"
223 call assert_equal('yyyex xywoxx', getline(1))
224 call assert_equal(expected, prop_list(1))
225
226 exe "normal 0fwRyy\<BS>"
227 call assert_equal('yyyex xyyoxx', getline(1))
228 call assert_equal(expected, prop_list(1))
229
230 exe "normal 0foRyy\<BS>\<BS>"
231 call assert_equal('yyyex xyyoxx', getline(1))
232 call assert_equal(expected, prop_list(1))
233
234 call DeletePropTypes()
235 bwipe!
236 set bs&
237endfunc
238
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100239func Test_prop_clear()
240 new
241 call AddPropTypes()
242 call SetupPropsInFirstLine()
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100243 call assert_equal(Get_expected_props(), prop_list(1))
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100244
245 call prop_clear(1)
246 call assert_equal([], prop_list(1))
247
248 call DeletePropTypes()
249 bwipe!
250endfunc
251
252func Test_prop_clear_buf()
253 new
254 call AddPropTypes()
255 call SetupPropsInFirstLine()
256 let bufnr = bufnr('')
257 wincmd w
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100258 call assert_equal(Get_expected_props(), prop_list(1, {'bufnr': bufnr}))
Bram Moolenaar98aefe72018-12-13 22:20:09 +0100259
260 call prop_clear(1, 1, {'bufnr': bufnr})
261 call assert_equal([], prop_list(1, {'bufnr': bufnr}))
262
263 wincmd w
264 call DeletePropTypes()
265 bwipe!
266endfunc
267
Bram Moolenaar21b50382019-01-04 18:07:24 +0100268func Test_prop_setline()
269 new
270 call AddPropTypes()
271 call SetupPropsInFirstLine()
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100272 call assert_equal(Get_expected_props(), prop_list(1))
Bram Moolenaar21b50382019-01-04 18:07:24 +0100273
274 call setline(1, 'foobar')
275 call assert_equal([], prop_list(1))
276
277 call DeletePropTypes()
278 bwipe!
279endfunc
280
281func Test_prop_setbufline()
282 new
283 call AddPropTypes()
284 call SetupPropsInFirstLine()
285 let bufnr = bufnr('')
286 wincmd w
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100287 call assert_equal(Get_expected_props(), prop_list(1, {'bufnr': bufnr}))
Bram Moolenaar21b50382019-01-04 18:07:24 +0100288
289 call setbufline(bufnr, 1, 'foobar')
290 call assert_equal([], prop_list(1, {'bufnr': bufnr}))
291
292 wincmd w
293 call DeletePropTypes()
294 bwipe!
295endfunc
296
Bram Moolenaar4164bb22019-01-04 23:09:49 +0100297func Test_prop_substitute()
298 new
299 " Set first line to 'one two three'
300 call AddPropTypes()
301 call SetupPropsInFirstLine()
302 let expected_props = Get_expected_props()
303 call assert_equal(expected_props, prop_list(1))
304
305 " Change "n" in "one" to XX: 'oXXe two three'
306 s/n/XX/
307 let expected_props[0].length += 1
308 let expected_props[1].length += 1
309 let expected_props[2].col += 1
310 let expected_props[3].col += 1
311 call assert_equal(expected_props, prop_list(1))
312
313 " Delete "t" in "two" and "three" to XX: 'oXXe wo hree'
314 s/t//g
315 let expected_props[0].length -= 2
316 let expected_props[2].length -= 1
317 let expected_props[3].length -= 1
318 let expected_props[3].col -= 1
319 call assert_equal(expected_props, prop_list(1))
320
321 " Split the line by changing w to line break: 'oXXe ', 'o hree'
322 " The long prop is split and spans both lines.
323 " The props on "two" and "three" move to the next line.
324 s/w/\r/
325 let new_props = [
326 \ copy(expected_props[0]),
327 \ copy(expected_props[2]),
328 \ copy(expected_props[3]),
329 \ ]
330 let expected_props[0].length = 5
331 unlet expected_props[3]
332 unlet expected_props[2]
333 call assert_equal(expected_props, prop_list(1))
334
335 let new_props[0].length = 6
336 let new_props[1].col = 1
337 let new_props[1].length = 1
338 let new_props[2].col = 3
339 call assert_equal(new_props, prop_list(2))
340
341 call DeletePropTypes()
342 bwipe!
343endfunc
344
Bram Moolenaarc1a9bc12018-12-28 21:59:29 +0100345" Setup a three line prop in lines 2 - 4.
346" Add short props in line 1 and 5.
347func Setup_three_line_prop()
348 new
349 call setline(1, ['one', 'twotwo', 'three', 'fourfour', 'five'])
350 call prop_add(1, 2, {'length': 1, 'type': 'comment'})
351 call prop_add(2, 4, {'end_lnum': 4, 'end_col': 5, 'type': 'comment'})
352 call prop_add(5, 2, {'length': 1, 'type': 'comment'})
353endfunc
354
Bram Moolenaare3d31b02018-12-24 23:07:04 +0100355func Test_prop_multiline()
356 call prop_type_add('comment', {'highlight': 'Directory'})
357 new
358 call setline(1, ['xxxxxxx', 'yyyyyyyyy', 'zzzzzzzz'])
359
360 " start halfway line 1, end halfway line 3
361 call prop_add(1, 3, {'end_lnum': 3, 'end_col': 5, 'type': 'comment'})
362 let expect1 = {'col': 3, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
363 call assert_equal([expect1], prop_list(1))
364 let expect2 = {'col': 1, 'length': 10, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
365 call assert_equal([expect2], prop_list(2))
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100366 let expect3 = {'col': 1, 'length': 4, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0}
Bram Moolenaare3d31b02018-12-24 23:07:04 +0100367 call assert_equal([expect3], prop_list(3))
368 call prop_clear(1, 3)
369
370 " include all three lines
371 call prop_add(1, 1, {'end_lnum': 3, 'end_col': 999, 'type': 'comment'})
372 let expect1.col = 1
373 let expect1.length = 8
374 call assert_equal([expect1], prop_list(1))
375 call assert_equal([expect2], prop_list(2))
376 let expect3.length = 9
377 call assert_equal([expect3], prop_list(3))
378 call prop_clear(1, 3)
379
380 bwipe!
Bram Moolenaarc1a9bc12018-12-28 21:59:29 +0100381
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100382 " Test deleting the first line of a multi-line prop.
Bram Moolenaarc1a9bc12018-12-28 21:59:29 +0100383 call Setup_three_line_prop()
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100384 let expect_short = {'col': 2, 'length': 1, 'type': 'comment', 'start': 1, 'end': 1, 'id': 0}
385 call assert_equal([expect_short], prop_list(1))
Bram Moolenaarc1a9bc12018-12-28 21:59:29 +0100386 let expect2 = {'col': 4, 'length': 4, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
387 call assert_equal([expect2], prop_list(2))
388 2del
Bram Moolenaarc1a9bc12018-12-28 21:59:29 +0100389 call assert_equal([expect_short], prop_list(1))
390 let expect2 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
391 call assert_equal([expect2], prop_list(2))
392 bwipe!
393
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100394 " Test deleting the last line of a multi-line prop.
Bram Moolenaarc1a9bc12018-12-28 21:59:29 +0100395 call Setup_three_line_prop()
396 let expect3 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
397 call assert_equal([expect3], prop_list(3))
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100398 let expect4 = {'col': 1, 'length': 4, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0}
Bram Moolenaarc1a9bc12018-12-28 21:59:29 +0100399 call assert_equal([expect4], prop_list(4))
400 4del
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100401 let expect3.end = 1
Bram Moolenaarc1a9bc12018-12-28 21:59:29 +0100402 call assert_equal([expect3], prop_list(3))
403 call assert_equal([expect_short], prop_list(4))
404 bwipe!
405
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100406 " Test appending a line below the multi-line text prop start.
Bram Moolenaarb56ac042018-12-28 23:22:40 +0100407 call Setup_three_line_prop()
408 let expect2 = {'col': 4, 'length': 4, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
409 call assert_equal([expect2], prop_list(2))
410 call append(2, "new line")
411 call assert_equal([expect2], prop_list(2))
412 let expect3 = {'col': 1, 'length': 9, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
413 call assert_equal([expect3], prop_list(3))
414 bwipe!
415
Bram Moolenaare3d31b02018-12-24 23:07:04 +0100416 call prop_type_delete('comment')
417endfunc
418
Bram Moolenaarb413d2e2018-12-25 23:15:46 +0100419func Test_prop_byteoff()
420 call prop_type_add('comment', {'highlight': 'Directory'})
421 new
Bram Moolenaar00b1e042018-12-26 23:42:10 +0100422 call setline(1, ['line1', 'second line', ''])
Bram Moolenaar8cf734e2018-12-26 01:09:00 +0100423 set ff=unix
Bram Moolenaar00b1e042018-12-26 23:42:10 +0100424 call assert_equal(19, line2byte(3))
Bram Moolenaarb413d2e2018-12-25 23:15:46 +0100425 call prop_add(1, 1, {'end_col': 3, 'type': 'comment'})
Bram Moolenaar00b1e042018-12-26 23:42:10 +0100426 call assert_equal(19, line2byte(3))
Bram Moolenaarb413d2e2018-12-25 23:15:46 +0100427
428 bwipe!
429 call prop_type_delete('comment')
430endfunc
431
Bram Moolenaar7f1664e2019-01-04 17:21:24 +0100432func Test_prop_undo()
433 new
434 call prop_type_add('comment', {'highlight': 'Directory'})
435 call setline(1, ['oneone', 'twotwo', 'three'])
436 " Set 'undolevels' to break changes into undo-able pieces.
437 set ul&
438
439 call prop_add(1, 3, {'end_col': 5, 'type': 'comment'})
440 let expected = [{'col': 3, 'length': 2, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
441 call assert_equal(expected, prop_list(1))
442
443 " Insert a character, then undo.
444 exe "normal 0lllix\<Esc>"
445 set ul&
446 let expected[0].length = 3
447 call assert_equal(expected, prop_list(1))
448 undo
449 let expected[0].length = 2
450 call assert_equal(expected, prop_list(1))
451
452 " Delete a character, then undo
453 exe "normal 0lllx"
454 set ul&
455 let expected[0].length = 1
456 call assert_equal(expected, prop_list(1))
457 undo
458 let expected[0].length = 2
459 call assert_equal(expected, prop_list(1))
460
461 " Delete the line, then undo
462 1d
463 set ul&
464 call assert_equal([], prop_list(1))
465 undo
466 call assert_equal(expected, prop_list(1))
467
468 " Insert a character, delete two characters, then undo with "U"
469 exe "normal 0lllix\<Esc>"
470 set ul&
471 let expected[0].length = 3
472 call assert_equal(expected, prop_list(1))
473 exe "normal 0lllxx"
474 set ul&
475 let expected[0].length = 1
476 call assert_equal(expected, prop_list(1))
477 normal U
478 let expected[0].length = 2
479 call assert_equal(expected, prop_list(1))
480
481 bwipe!
482 call prop_type_delete('comment')
483endfunc
484
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100485" screenshot test with textprop highlighting
486funct Test_textprop_screenshots()
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100487 if !CanRunVimInTerminal() || &encoding != 'utf-8'
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100488 return
489 endif
490 call writefile([
Bram Moolenaar44746aa2019-01-02 00:02:11 +0100491 \ "call setline(1, ['One two', 'Numbér 123 änd thœn 4¾7.', '--aa--bb--cc--dd--'])",
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100492 \ "hi NumberProp ctermfg=blue",
493 \ "hi LongProp ctermbg=yellow",
494 \ "call prop_type_add('number', {'highlight': 'NumberProp'})",
495 \ "call prop_type_add('long', {'highlight': 'LongProp'})",
Bram Moolenaar44746aa2019-01-02 00:02:11 +0100496 \ "call prop_type_add('start', {'highlight': 'NumberProp', 'start_incl': 1})",
497 \ "call prop_type_add('end', {'highlight': 'NumberProp', 'end_incl': 1})",
498 \ "call prop_type_add('both', {'highlight': 'NumberProp', 'start_incl': 1, 'end_incl': 1})",
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100499 \ "call prop_add(1, 4, {'end_lnum': 3, 'end_col': 3, 'type': 'long'})",
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100500 \ "call prop_add(2, 9, {'length': 3, 'type': 'number'})",
501 \ "call prop_add(2, 24, {'length': 4, 'type': 'number'})",
Bram Moolenaar44746aa2019-01-02 00:02:11 +0100502 \ "call prop_add(3, 3, {'length': 2, 'type': 'number'})",
503 \ "call prop_add(3, 7, {'length': 2, 'type': 'start'})",
504 \ "call prop_add(3, 11, {'length': 2, 'type': 'end'})",
505 \ "call prop_add(3, 15, {'length': 2, 'type': 'both'})",
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100506 \ "set number",
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100507 \ "hi clear SpellBad",
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100508 \ "set spell",
Bram Moolenaar44746aa2019-01-02 00:02:11 +0100509 \ "normal 3G0llix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>",
Bram Moolenaar33c8ca92019-01-02 18:00:27 +0100510 \ "normal 3G0lli\<BS>\<Esc>",
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100511 \], 'XtestProp')
Bram Moolenaarb9c67a52019-01-01 19:49:20 +0100512 let buf = RunVimInTerminal('-S XtestProp', {'rows': 6})
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100513 call VerifyScreenDump(buf, 'Test_textprop_01', {})
Bram Moolenaare3d31b02018-12-24 23:07:04 +0100514
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100515 " clean up
516 call StopVimInTerminal(buf)
Bram Moolenaar2f21fa82018-12-31 20:05:56 +0100517 call delete('XtestProp')
Bram Moolenaarc6d86dc2018-12-31 13:57:36 +0100518endfunc