annotate src/testdir/test_textprop.vim @ 34623:65e7eaf68f19 v9.1.0200

patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines Commit: https://github.com/vim/vim/commit/b2d124c6258ff41e1f951bf39a4afc386d79ddc4 Author: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Date: Sun Mar 24 09:43:25 2024 +0100 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines Problem: `gj`/`gk` was updating the desired cursor virtual column to the outer virtual text, even though the actual cursor position was moved to not be on the virtual text, leading the need to do an extra `gj`/`gk` to move past each virtual text line. (rickhowe) Solution: Exclude the outer virtual text when getting the line length for moving the cursor with `gj`/`gk`, so that no extra movement is needed to skip over virtual text lines. (Dylan Thacker-Smith) fixes: #12028 related: #14262 Signed-off-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Mar 2024 10:00:05 +0100
parents cb36b351c2de
children ad1b0609b2f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for defining text property types and adding text properties to the
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " buffer.
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 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
5 CheckFeature textprop
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
7 source screendump.vim
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26384
diff changeset
8 import './vim9.vim' as v9
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
9
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 func Test_proptype_global()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 call prop_type_add('comment', {'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 let proptypes = prop_type_list()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 call assert_equal(1, len(proptypes))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 call assert_equal('comment', proptypes[0])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 let proptype = prop_type_get('comment')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 call assert_equal('Directory', proptype['highlight'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 call assert_equal(123, proptype['priority'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 call assert_equal(1, proptype['start_incl'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 call assert_equal(1, proptype['end_incl'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 call prop_type_delete('comment')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 call assert_equal(0, len(prop_type_list()))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 call prop_type_add('one', {})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 call assert_equal(1, len(prop_type_list()))
17980
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
27 let proptype = 'one'->prop_type_get()
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 call assert_false(has_key(proptype, 'highlight'))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 call assert_equal(0, proptype['priority'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 call assert_equal(0, proptype['start_incl'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call assert_equal(0, proptype['end_incl'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 call prop_type_add('two', {})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 call assert_equal(2, len(prop_type_list()))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 call prop_type_delete('one')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 call assert_equal(1, len(prop_type_list()))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 call prop_type_delete('two')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 call assert_equal(0, len(prop_type_list()))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 func Test_proptype_buf()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 let bufnr = bufnr('')
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
43 call prop_type_add('comment', #{bufnr: bufnr, highlight: 'Directory', priority: 123, start_incl: 1, end_incl: 1})
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 let proptypes = prop_type_list({'bufnr': bufnr})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 call assert_equal(1, len(proptypes))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 call assert_equal('comment', proptypes[0])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 let proptype = prop_type_get('comment', {'bufnr': bufnr})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 call assert_equal('Directory', proptype['highlight'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 call assert_equal(123, proptype['priority'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 call assert_equal(1, proptype['start_incl'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 call assert_equal(1, proptype['end_incl'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 call prop_type_delete('comment', {'bufnr': bufnr})
17980
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
55 call assert_equal(0, len({'bufnr': bufnr}->prop_type_list()))
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 call prop_type_add('one', {'bufnr': bufnr})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 let proptype = prop_type_get('one', {'bufnr': bufnr})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 call assert_false(has_key(proptype, 'highlight'))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 call assert_equal(0, proptype['priority'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 call assert_equal(0, proptype['start_incl'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 call assert_equal(0, proptype['end_incl'])
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 call prop_type_add('two', {'bufnr': bufnr})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 call assert_equal(2, len(prop_type_list({'bufnr': bufnr})))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 call prop_type_delete('one', {'bufnr': bufnr})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 call assert_equal(1, len(prop_type_list({'bufnr': bufnr})))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 call prop_type_delete('two', {'bufnr': bufnr})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 call assert_equal(0, len(prop_type_list({'bufnr': bufnr})))
16772
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
70
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
71 call assert_fails("call prop_type_add('one', {'bufnr': 98764})", "E158:")
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73
29664
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
74 def Test_proptype_add_remove()
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
75 # add and remove a prop type so that the array is empty
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
76 prop_type_add('local', {bufnr: bufnr('%')})
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
77 prop_type_delete('local', {bufnr: bufnr('%')})
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
78 prop_type_add('global', {highlight: 'ErrorMsg'})
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
79 prop_add(1, 1, {length: 1, type: 'global'})
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
80 redraw
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
81
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
82 prop_clear(1)
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
83 prop_type_delete('global')
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
84 enddef
6569c71c5ca5 patch 9.0.0172: trying to allocate zero bytes
Bram Moolenaar <Bram@vim.org>
parents: 29657
diff changeset
85
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
86 def Test_proptype_buf_list()
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
87 new
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
88 var bufnr = bufnr('')
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
89 try
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
90 prop_type_add('global', {})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
91 prop_type_add('local', {bufnr: bufnr})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
92
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
93 prop_add(1, 1, {type: 'global'})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
94 prop_add(1, 1, {type: 'local'})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
95
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
96 assert_equal([
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
97 {type: 'local', type_bufnr: bufnr, id: 0, col: 1, end: 1, length: 0, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
98 {type: 'global', type_bufnr: 0, id: 0, col: 1, end: 1, length: 0, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
99 ], prop_list(1))
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
100 assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
101 {lnum: 1, id: 0, col: 1, type_bufnr: bufnr, end: 1, type: 'local', length: 0, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
102 prop_find({lnum: 1, type: 'local'}))
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
103 assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
104 {lnum: 1, id: 0, col: 1, type_bufnr: 0, end: 1, type: 'global', length: 0, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
105 prop_find({lnum: 1, type: 'global'}))
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
106
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
107 prop_remove({type: 'global'}, 1)
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
108 prop_remove({type: 'local'}, 1)
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
109 finally
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
110 prop_type_delete('global')
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
111 prop_type_delete('local', {bufnr: bufnr})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
112 bwipe!
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
113 endtry
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
114 enddef
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
115
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 func AddPropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 call prop_type_add('one', {})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 call prop_type_add('two', {})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 call prop_type_add('three', {})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 call prop_type_add('whole', {})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 func DeletePropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 call prop_type_delete('one')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 call prop_type_delete('two')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 call prop_type_delete('three')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 call prop_type_delete('whole')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 func SetupPropsInFirstLine()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 call setline(1, 'one two three')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 call prop_add(1, 1, {'length': 3, 'id': 11, 'type': 'one'})
17980
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
133 eval 1->prop_add(5, {'length': 3, 'id': 12, 'type': 'two'})
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
134 call prop_add(1, 9, {'length': 5, 'id': 13, 'type': 'three'})
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 call prop_add(1, 1, {'length': 13, 'id': 14, 'type': 'whole'})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
138 func Get_expected_props()
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
139 return [
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
140 \ #{type_bufnr: 0, col: 1, length: 13, id: 14, type: 'whole', start: 1, end: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
141 \ #{type_bufnr: 0, col: 1, length: 3, id: 11, type: 'one', start: 1, end: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
142 \ #{type_bufnr: 0, col: 5, length: 3, id: 12, type: 'two', start: 1, end: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
143 \ #{type_bufnr: 0, col: 9, length: 5, id: 13, type: 'three', start: 1, end: 1},
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 \ ]
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
145 endfunc
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
147 func Test_prop_find()
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
148 new
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
149 call setline(1, ['one one one', 'twotwo', 'three', 'fourfour', 'five', 'sixsix'])
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
150
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
151 " Add two text props on lines 1 and 5, and one spanning lines 2 to 4.
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
152 call prop_type_add('prop_name', {'highlight': 'Directory'})
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
153 call prop_add(1, 5, {'type': 'prop_name', 'id': 10, 'length': 3})
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
154 call prop_add(2, 4, {'type': 'prop_name', 'id': 11, 'end_lnum': 4, 'end_col': 9})
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
155 call prop_add(5, 4, {'type': 'prop_name', 'id': 12, 'length': 1})
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
156
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
157 let expected = [
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
158 \ #{type_bufnr: 0, lnum: 1, col: 5, length: 3, id: 10, type: 'prop_name', start: 1, end: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
159 \ #{type_bufnr: 0, lnum: 2, col: 4, id: 11, type: 'prop_name', start: 1, end: 0},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
160 \ #{type_bufnr: 0, lnum: 5, col: 4, length: 1, id: 12, type: 'prop_name', start: 1, end: 1}
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
161 \ ]
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
162
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
163 " Starting at line 5 col 1 this should find the prop at line 5 col 4.
29788
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
164 call cursor(5, 1)
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
165 let result = prop_find({'type': 'prop_name'}, 'f')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
166 call assert_equal(expected[2], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
167
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
168 " With skipstart left at false (default), this should find the prop at line
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
169 " 5 col 4.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
170 let result = prop_find({'type': 'prop_name', 'lnum': 5, 'col': 4}, 'b')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
171 call assert_equal(expected[2], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
172
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
173 " With skipstart set to true, this should skip the prop at line 5 col 4.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
174 let result = prop_find({'type': 'prop_name', 'lnum': 5, 'col': 4, 'skipstart': 1}, 'b')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
175 unlet result.length
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
176 call assert_equal(expected[1], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
177
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
178 " Search backwards from line 1 col 10 to find the prop on the same line.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
179 let result = prop_find({'type': 'prop_name', 'lnum': 1, 'col': 10}, 'b')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
180 call assert_equal(expected[0], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
181
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
182 " with skipstart set to false, if the start position is anywhere between the
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
183 " start and end lines of a text prop (searching forward or backward), the
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
184 " result should be the prop on the first line (the line with 'start' set to 1).
29788
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
185 call cursor(3, 1)
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
186 let result = prop_find({'type': 'prop_name'}, 'f')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
187 unlet result.length
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
188 call assert_equal(expected[1], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
189 let result = prop_find({'type': 'prop_name'}, 'b')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
190 unlet result.length
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
191 call assert_equal(expected[1], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
192
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
193 " with skipstart set to true, if the start position is anywhere between the
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
194 " start and end lines of a text prop (searching forward or backward), all lines
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
195 " of the prop will be skipped.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
196 let result = prop_find({'type': 'prop_name', 'skipstart': 1}, 'b')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
197 call assert_equal(expected[0], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
198 let result = prop_find({'type': 'prop_name', 'skipstart': 1}, 'f')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
199 call assert_equal(expected[2], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
200
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
201 " Use skipstart to search through all props with type name 'prop_name'.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
202 " First forward...
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
203 let lnum = 1
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
204 let col = 1
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
205 let i = 0
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
206 for exp in expected
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
207 let result = prop_find({'type': 'prop_name', 'lnum': lnum, 'col': col, 'skipstart': 1}, 'f')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
208 if !has_key(exp, "length")
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
209 unlet result.length
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
210 endif
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
211 call assert_equal(exp, result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
212 let lnum = result.lnum
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
213 let col = result.col
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
214 let i = i + 1
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
215 endfor
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
216
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
217 " ...then backwards.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
218 let lnum = 6
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
219 let col = 4
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
220 let i = 2
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
221 while i >= 0
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
222 let result = prop_find({'type': 'prop_name', 'lnum': lnum, 'col': col, 'skipstart': 1}, 'b')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
223 if !has_key(expected[i], "length")
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
224 unlet result.length
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
225 endif
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
226 call assert_equal(expected[i], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
227 let lnum = result.lnum
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
228 let col = result.col
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
229 let i = i - 1
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
230 endwhile
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
231
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
232 " Starting from line 6 col 1 search backwards for prop with id 10.
29788
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
233 call cursor(6, 1)
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
234 let result = prop_find({'id': 10, 'skipstart': 1}, 'b')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
235 call assert_equal(expected[0], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
236
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
237 " Starting from line 1 col 1 search forwards for prop with id 12.
29788
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
238 call cursor(1, 1)
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
239 let result = prop_find({'id': 12}, 'f')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
240 call assert_equal(expected[2], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
241
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
242 " Search for a prop with an unknown id.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
243 let result = prop_find({'id': 999}, 'f')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
244 call assert_equal({}, result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
245
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
246 " Search backwards from the proceeding position of the prop with id 11
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
247 " (at line num 2 col 4). This should return an empty dict.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
248 let result = prop_find({'id': 11, 'lnum': 2, 'col': 3}, 'b')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
249 call assert_equal({}, result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
250
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
251 " When lnum is given and col is omitted, use column 1.
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
252 let result = prop_find({'type': 'prop_name', 'lnum': 1}, 'f')
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
253 call assert_equal(expected[0], result)
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
254
25471
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
255 " Negative ID is possible, just like prop is not found.
25441
e06540cc3371 patch 8.2.3257: calling prop_find() with -1 for ID gives errornous error
Bram Moolenaar <Bram@vim.org>
parents: 25392
diff changeset
256 call assert_equal({}, prop_find({'id': -1}))
25471
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
257 call assert_equal({}, prop_find({'id': -2}))
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
258
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
259 call prop_clear(1, 6)
25441
e06540cc3371 patch 8.2.3257: calling prop_find() with -1 for ID gives errornous error
Bram Moolenaar <Bram@vim.org>
parents: 25392
diff changeset
260
25471
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
261 " Default ID is zero
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
262 call prop_add(5, 4, {'type': 'prop_name', 'length': 1})
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
263 call assert_equal(#{lnum: 5, id: 0, col: 4, type_bufnr: 0, end: 1, type: 'prop_name', length: 1, start: 1}, prop_find({'id': 0}))
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
264
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
265 call prop_type_delete('prop_name')
25471
3678a11e71fa patch 8.2.3272: cannot use id zero with prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 25441
diff changeset
266 call prop_clear(1, 6)
22069
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
267 bwipe!
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
268 endfunc
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
269
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
270 def Test_prop_find2()
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
271 # Multiple props per line, start on the first, should find the second.
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
272 new
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
273 ['the quikc bronw fox jumsp over the layz dog']->repeat(2)->setline(1)
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
274 prop_type_add('misspell', {highlight: 'ErrorMsg'})
22037
35c8996a798e patch 8.2.1568: prop_find() skips properties in the same line
Bram Moolenaar <Bram@vim.org>
parents: 21552
diff changeset
275 for lnum in [1, 2]
35c8996a798e patch 8.2.1568: prop_find() skips properties in the same line
Bram Moolenaar <Bram@vim.org>
parents: 21552
diff changeset
276 for col in [8, 14, 24, 38]
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
277 prop_add(lnum, col, {type: 'misspell', length: 2})
22037
35c8996a798e patch 8.2.1568: prop_find() skips properties in the same line
Bram Moolenaar <Bram@vim.org>
parents: 21552
diff changeset
278 endfor
35c8996a798e patch 8.2.1568: prop_find() skips properties in the same line
Bram Moolenaar <Bram@vim.org>
parents: 21552
diff changeset
279 endfor
22069
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
280 cursor(1, 8)
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
281 var expected = {type_bufnr: 0, lnum: 1, id: 0, col: 14, end: 1, type: 'misspell', length: 2, start: 1}
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
282 var result = prop_find({type: 'misspell', skipstart: true}, 'f')
22069
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
283 assert_equal(expected, result)
22037
35c8996a798e patch 8.2.1568: prop_find() skips properties in the same line
Bram Moolenaar <Bram@vim.org>
parents: 21552
diff changeset
284
22069
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
285 prop_type_delete('misspell')
22037
35c8996a798e patch 8.2.1568: prop_find() skips properties in the same line
Bram Moolenaar <Bram@vim.org>
parents: 21552
diff changeset
286 bwipe!
22069
87502e318c19 patch 8.2.1584: Vim9: cannot use "true" for "skipstart" in prop_find()
Bram Moolenaar <Bram@vim.org>
parents: 22037
diff changeset
287 enddef
19100
91bb12995034 patch 8.2.0110: prop_find() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 19097
diff changeset
288
19642
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
289 func Test_prop_find_smaller_len_than_match_col()
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
290 new
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
291 call prop_type_add('test', {'highlight': 'ErrorMsg'})
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
292 call setline(1, ['xxxx', 'x'])
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
293 call prop_add(1, 4, {'type': 'test'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
294 call assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
295 \ #{type_bufnr: 0, id: 0, lnum: 1, col: 4, type: 'test', length: 0, start: 1, end: 1},
19642
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
296 \ prop_find({'type': 'test', 'lnum': 2, 'col': 1}, 'b'))
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
297 bwipe!
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
298 call prop_type_delete('test')
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
299 endfunc
647ef636a11e patch 8.2.0378: prop_find() does not find all props
Bram Moolenaar <Bram@vim.org>
parents: 19631
diff changeset
300
24252
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
301 func Test_prop_find_with_both_option_enabled()
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
302 " Initialize
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
303 new
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
304 call AddPropTypes()
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
305 call SetupPropsInFirstLine()
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
306 let props = Get_expected_props()->map({_, v -> extend(v, {'lnum': 1})})
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
307 " Test
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
308 call assert_fails("call prop_find({'both': 1})", 'E968:')
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
309 call assert_fails("call prop_find({'id': 11, 'both': 1})", 'E860:')
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
310 call assert_fails("call prop_find({'type': 'three', 'both': 1})", 'E860:')
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
311 call assert_equal({}, prop_find({'id': 11, 'type': 'three', 'both': 1}))
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
312 call assert_equal({}, prop_find({'id': 130000, 'type': 'one', 'both': 1}))
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
313 call assert_equal(props[2], prop_find({'id': 12, 'type': 'two', 'both': 1}))
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
314 call assert_equal(props[0], prop_find({'id': 14, 'type': 'whole', 'both': 1}))
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
315 " Clean up
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
316 call DeletePropTypes()
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
317 bwipe!
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
318 endfunc
7422f2f719a3 patch 8.2.2667: prop_find() cannot find item matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 24039
diff changeset
319
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 func Test_prop_add()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321 new
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 call AddPropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323 call SetupPropsInFirstLine()
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
324 let expected_props = Get_expected_props()
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
325 call assert_equal(expected_props, prop_list(1))
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 call assert_fails("call prop_add(10, 1, {'length': 1, 'id': 14, 'type': 'whole'})", 'E966:')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 call assert_fails("call prop_add(1, 22, {'length': 1, 'id': 14, 'type': 'whole'})", 'E964:')
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
328
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329 " Insert a line above, text props must still be there.
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 call append(0, 'empty')
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
331 call assert_equal(expected_props, prop_list(2))
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 " Delete a line above, text props must still be there.
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333 1del
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
334 call assert_equal(expected_props, prop_list(1))
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
336 " Prop without length or end column is zero length
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
337 call prop_clear(1)
19534
36ec10251b2b patch 8.2.0324: text property not updated correctly when inserting/deleting
Bram Moolenaar <Bram@vim.org>
parents: 19110
diff changeset
338 call prop_type_add('included', {'start_incl': 1, 'end_incl': 1})
36ec10251b2b patch 8.2.0324: text property not updated correctly when inserting/deleting
Bram Moolenaar <Bram@vim.org>
parents: 19110
diff changeset
339 call prop_add(1, 5, #{type: 'included'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
340 let expected = [#{type_bufnr: 0, col: 5, length: 0, type: 'included', id: 0, start: 1, end: 1}]
19534
36ec10251b2b patch 8.2.0324: text property not updated correctly when inserting/deleting
Bram Moolenaar <Bram@vim.org>
parents: 19110
diff changeset
341 call assert_equal(expected, prop_list(1))
36ec10251b2b patch 8.2.0324: text property not updated correctly when inserting/deleting
Bram Moolenaar <Bram@vim.org>
parents: 19110
diff changeset
342
36ec10251b2b patch 8.2.0324: text property not updated correctly when inserting/deleting
Bram Moolenaar <Bram@vim.org>
parents: 19110
diff changeset
343 " Inserting text makes the prop bigger.
36ec10251b2b patch 8.2.0324: text property not updated correctly when inserting/deleting
Bram Moolenaar <Bram@vim.org>
parents: 19110
diff changeset
344 exe "normal 5|ixx\<Esc>"
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
345 let expected = [#{type_bufnr: 0, col: 5, length: 2, type: 'included', id: 0, start: 1, end: 1}]
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
346 call assert_equal(expected, prop_list(1))
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
347
16772
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
348 call assert_fails("call prop_add(1, 5, {'type': 'two', 'bufnr': 234343})", 'E158:')
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
349
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 call DeletePropTypes()
19534
36ec10251b2b patch 8.2.0324: text property not updated correctly when inserting/deleting
Bram Moolenaar <Bram@vim.org>
parents: 19110
diff changeset
351 call prop_type_delete('included')
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 bwipe!
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354
25640
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
355 " Test for the prop_add_list() function
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
356 func Test_prop_add_list()
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
357 new
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
358 call AddPropTypes()
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
359 call setline(1, ['one one one', 'two two two', 'six six six', 'ten ten ten'])
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
360 call prop_add_list(#{type: 'one', id: 2},
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
361 \ [[1, 1, 1, 3], [2, 5, 2, 7], [3, 6, 4, 6]])
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
362 call assert_equal([#{id: 2, col: 1, type_bufnr: 0, end: 1, type: 'one',
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
363 \ length: 2, start: 1}], prop_list(1))
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
364 call assert_equal([#{id: 2, col: 5, type_bufnr: 0, end: 1, type: 'one',
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
365 \ length: 2, start: 1}], prop_list(2))
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
366 call assert_equal([#{id: 2, col: 6, type_bufnr: 0, end: 0, type: 'one',
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
367 \ length: 7, start: 1}], prop_list(3))
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
368 call assert_equal([#{id: 2, col: 1, type_bufnr: 0, end: 1, type: 'one',
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
369 \ length: 5, start: 0}], prop_list(4))
30813
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
370 call prop_remove(#{id: 2})
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
371 call assert_equal([], prop_list(1))
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
372
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
373 call prop_add_list(#{type: 'one', id: 3},
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
374 \ [[1, 1, 1, 3], [2, 5, 2, 7, 9]])
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
375 call assert_equal([#{id: 3, col: 1, type_bufnr: 0, end: 1, type: 'one',
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
376 \ length: 2, start: 1}], prop_list(1))
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
377 call assert_equal([#{id: 9, col: 5, type_bufnr: 0, end: 1, type: 'one',
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
378 \ length: 2, start: 1}], prop_list(2))
f4956427ee9e patch 9.0.0741: cannot specify an ID for each item with prop_add_list()
Bram Moolenaar <Bram@vim.org>
parents: 30811
diff changeset
379
25640
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
380 call assert_fails('call prop_add_list([1, 2], [[1, 1, 3]])', 'E1206:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
381 call assert_fails('call prop_add_list({}, {})', 'E1211:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
382 call assert_fails('call prop_add_list({}, [[1, 1, 3]])', 'E965:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
383 call assert_fails('call prop_add_list(#{type: "abc"}, [[1, 1, 1, 3]])', 'E971:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
384 call assert_fails('call prop_add_list(#{type: "one"}, [[]])', 'E474:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
385 call assert_fails('call prop_add_list(#{type: "one"}, [[1, 1, 1, 1], {}])', 'E714:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
386 call assert_fails('call prop_add_list(#{type: "one"}, [[1, 1, "a"]])', 'E474:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
387 call assert_fails('call prop_add_list(#{type: "one"}, [[2, 2]])', 'E474:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
388 call assert_fails('call prop_add_list(#{type: "one"}, [[1, 1, 2], [2, 2]])', 'E474:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
389 call assert_fails('call prop_add_list(#{type: "one"}, [[1, 1, 1, 2], [4, 1, 5, 2]])', 'E966:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
390 call assert_fails('call prop_add_list(#{type: "one"}, [[3, 1, 1, 2]])', 'E966:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
391 call assert_fails('call prop_add_list(#{type: "one"}, [[2, 2, 2, 2], [3, 20, 3, 22]])', 'E964:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
392 call assert_fails('eval #{type: "one"}->prop_add_list([[2, 2, 2, 2], [3, 20, 3, 22]])', 'E964:')
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
393 call assert_fails('call prop_add_list(test_null_dict(), [[2, 2, 2]])', 'E965:')
30015
adb0de8be4ce patch 9.0.0345: error message for list argument could be clearer
Bram Moolenaar <Bram@vim.org>
parents: 29994
diff changeset
394 call assert_fails('call prop_add_list(#{type: "one"}, test_null_list())', 'E1298:')
25640
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
395 call assert_fails('call prop_add_list(#{type: "one"}, [test_null_list()])', 'E714:')
30811
c02b74b87608 patch 9.0.0740: prop_add_list() gives multiple errors for invalid argument
Bram Moolenaar <Bram@vim.org>
parents: 30781
diff changeset
396
c02b74b87608 patch 9.0.0740: prop_add_list() gives multiple errors for invalid argument
Bram Moolenaar <Bram@vim.org>
parents: 30781
diff changeset
397 " only one error for multiple wrong values
c02b74b87608 patch 9.0.0740: prop_add_list() gives multiple errors for invalid argument
Bram Moolenaar <Bram@vim.org>
parents: 30781
diff changeset
398 call assert_fails('call prop_add_list(#{type: "one"}, [[{}, [], 0z00, 0.3]])', ['E728:', 'E728:'])
25640
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
399 call DeletePropTypes()
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
400 bw!
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
401 endfunc
78ef12e0ce8c patch 8.2.3356: adding many text properties requires a lot of function calls
Bram Moolenaar <Bram@vim.org>
parents: 25628
diff changeset
402
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
403 func Test_prop_remove()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
404 new
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
405 call AddPropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
406 call SetupPropsInFirstLine()
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
407 let props = Get_expected_props()
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
408 call assert_equal(props, prop_list(1))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
409
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
410 " remove by id
17980
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
411 call assert_equal(1, {'id': 12}->prop_remove(1))
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
412 unlet props[2]
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
413 call assert_equal(props, prop_list(1))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
414
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
415 " remove by type
16772
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
416 call assert_equal(1, prop_remove({'type': 'one'}, 1))
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
417 unlet props[1]
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
418 call assert_equal(props, prop_list(1))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
419
16772
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
420 " remove from unknown buffer
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
421 call assert_fails("call prop_remove({'type': 'one', 'bufnr': 123456}, 1)", 'E158:')
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
422
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
423 call DeletePropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
424 bwipe!
19601
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
425
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
426 new
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
427 call AddPropTypes()
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
428 call SetupPropsInFirstLine()
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
429 call prop_add(1, 6, {'length': 2, 'id': 11, 'type': 'three'})
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
430 let props = Get_expected_props()
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
431 call insert(props, #{type_bufnr: 0, col: 6, length: 2, id: 11, type: 'three', start: 1, end: 1}, 3)
19601
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
432 call assert_equal(props, prop_list(1))
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
433 call assert_equal(1, prop_remove({'type': 'three', 'id': 11, 'both': 1, 'all': 1}, 1))
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
434 unlet props[3]
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
435 call assert_equal(props, prop_list(1))
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
436
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 22069
diff changeset
437 call assert_fails("call prop_remove({'id': 11, 'both': 1})", 'E860:')
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 22069
diff changeset
438 call assert_fails("call prop_remove({'type': 'three', 'both': 1})", 'E860:')
19601
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
439
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
440 call DeletePropTypes()
67f39cb0a49c patch 8.2.0357: cannot delete a text property matching both id and type
Bram Moolenaar <Bram@vim.org>
parents: 19534
diff changeset
441 bwipe!
29788
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
442
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
443 new
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
444 call AddPropTypes()
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
445 call SetupPropsInFirstLine()
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
446 let props = Get_expected_props() " [whole, one, two, three]
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
447 call assert_equal(props, prop_list(1))
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
448
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
449 " remove one by types
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
450 call assert_equal(1, prop_remove({'types': ['one', 'two', 'three']}, 1))
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
451 unlet props[1] " [whole, two, three]
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
452 call assert_equal(props, prop_list(1))
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
453
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
454 " remove 'all' by types
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
455 call assert_equal(2, prop_remove({'types': ['three', 'whole'], 'all': 1}, 1))
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
456 unlet props[0] " [two, three]
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
457 unlet props[1] " [three]
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
458 call assert_equal(props, prop_list(1))
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
459
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
460 " remove none by types
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
461 call assert_equal(0, prop_remove({'types': ['three', 'whole'], 'all': 1}, 1))
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
462 call assert_equal(props, prop_list(1))
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
463
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
464 " no types
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
465 call assert_fails("call prop_remove({'types': []}, 1)", 'E968:')
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
466 call assert_fails("call prop_remove({'types': ['not_a_real_type']}, 1)", 'E971:')
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
467
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
468 " only one of types and type can be supplied
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
469 call assert_fails("call prop_remove({'type': 'one', 'types': ['three'], 'all': 1}, 1)", 'E1295:')
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
470
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
471 call DeletePropTypes()
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
472 bwipe!
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474
22127
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
475 def Test_prop_add_vim9()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
476 prop_type_add('comment', {
22127
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
477 highlight: 'Directory',
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
478 priority: 123,
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
479 start_incl: true,
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
480 end_incl: true,
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
481 combine: false,
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
482 })
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
483 prop_type_delete('comment')
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
484 enddef
9d3dfd420a45 patch 8.2.1613: Vim9: cannot pass "true" to prop_type_add()
Bram Moolenaar <Bram@vim.org>
parents: 22125
diff changeset
485
22125
602e660d5ccf patch 8.2.1612: Vim9: cannot pass "true" to prop_remove()
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
486 def Test_prop_remove_vim9()
602e660d5ccf patch 8.2.1612: Vim9: cannot pass "true" to prop_remove()
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
487 new
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26384
diff changeset
488 g:AddPropTypes()
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26384
diff changeset
489 g:SetupPropsInFirstLine()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
490 assert_equal(1, prop_remove({type: 'three', id: 13, both: true, all: true}))
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26384
diff changeset
491 g:DeletePropTypes()
22125
602e660d5ccf patch 8.2.1612: Vim9: cannot pass "true" to prop_remove()
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
492 bwipe!
602e660d5ccf patch 8.2.1612: Vim9: cannot pass "true" to prop_remove()
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
493 enddef
602e660d5ccf patch 8.2.1612: Vim9: cannot pass "true" to prop_remove()
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
494
15349
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
495 func SetupOneLine()
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
496 call setline(1, 'xonex xtwoxx')
16662
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
497 normal gg0
15349
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
498 call AddPropTypes()
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
499 call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'})
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
500 call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'})
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
501 let expected = [
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
502 \ #{type_bufnr: 0, col: 2, length: 3, id: 11, type: 'one', start: 1, end: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
503 \ #{type_bufnr: 0, col: 8, length: 3, id: 12, type: 'two', start: 1, end: 1},
15349
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
504 \]
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
505 call assert_equal(expected, prop_list(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
506 return expected
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
507 endfunc
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
508
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
509 func Test_prop_add_remove_buf()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
510 new
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
511 let bufnr = bufnr('')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
512 call AddPropTypes()
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
513 for lnum in range(1, 4)
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
514 call setline(lnum, 'one two three')
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
515 endfor
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
516 wincmd w
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
517 for lnum in range(1, 4)
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
518 call prop_add(lnum, 1, {'length': 3, 'id': 11, 'type': 'one', 'bufnr': bufnr})
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
519 call prop_add(lnum, 5, {'length': 3, 'id': 12, 'type': 'two', 'bufnr': bufnr})
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
520 call prop_add(lnum, 11, {'length': 3, 'id': 13, 'type': 'three', 'bufnr': bufnr})
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
521 endfor
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
522
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
523 let props = [
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
524 \ #{type_bufnr: 0, col: 1, length: 3, id: 11, type: 'one', start: 1, end: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
525 \ #{type_bufnr: 0, col: 5, length: 3, id: 12, type: 'two', start: 1, end: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
526 \ #{type_bufnr: 0, col: 11, length: 3, id: 13, type: 'three', start: 1, end: 1},
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
527 \]
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
528 call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
529
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
530 " remove by id
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
531 let before_props = deepcopy(props)
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
532 unlet props[1]
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
533
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
534 call prop_remove({'id': 12, 'bufnr': bufnr}, 1)
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
535 call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
536 call assert_equal(before_props, prop_list(2, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
537 call assert_equal(before_props, prop_list(3, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
538 call assert_equal(before_props, prop_list(4, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
539
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
540 call prop_remove({'id': 12, 'bufnr': bufnr}, 3, 4)
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
541 call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
542 call assert_equal(before_props, prop_list(2, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
543 call assert_equal(props, prop_list(3, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
544 call assert_equal(props, prop_list(4, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
545
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
546 call prop_remove({'id': 12, 'bufnr': bufnr})
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
547 for lnum in range(1, 4)
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
548 call assert_equal(props, prop_list(lnum, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
549 endfor
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
550
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
551 " remove by type
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
552 let before_props = deepcopy(props)
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
553 unlet props[0]
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
554
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
555 call prop_remove({'type': 'one', 'bufnr': bufnr}, 1)
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
556 call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
16060
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
557 call assert_equal(before_props, prop_list(2, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
558 call assert_equal(before_props, prop_list(3, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
559 call assert_equal(before_props, prop_list(4, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
560
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
561 call prop_remove({'type': 'one', 'bufnr': bufnr}, 3, 4)
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
562 call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
563 call assert_equal(before_props, prop_list(2, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
564 call assert_equal(props, prop_list(3, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
565 call assert_equal(props, prop_list(4, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
566
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
567 call prop_remove({'type': 'one', 'bufnr': bufnr})
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
568 for lnum in range(1, 4)
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
569 call assert_equal(props, prop_list(lnum, {'bufnr': bufnr}))
176872829dc2 patch 8.1.1035: prop_remove() second argument is not optional
Bram Moolenaar <Bram@vim.org>
parents: 15928
diff changeset
570 endfor
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 call DeletePropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 wincmd w
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574 bwipe!
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576
15347
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
577 func Test_prop_backspace()
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
578 new
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
579 set bs=2
15349
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
580 let expected = SetupOneLine() " 'xonex xtwoxx'
15347
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
581
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
582 exe "normal 0li\<BS>\<Esc>fxli\<BS>\<Esc>"
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
583 call assert_equal('one xtwoxx', getline(1))
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
584 let expected[0].col = 1
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
585 let expected[1].col = 6
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
586 call assert_equal(expected, prop_list(1))
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
587
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
588 call DeletePropTypes()
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
589 bwipe!
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
590 set bs&
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
591 endfunc
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
592
28841
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
593 func Test_prop_change()
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
594 new
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
595 let expected = SetupOneLine() " 'xonex xtwoxx'
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
596
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
597 " Characterwise.
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
598 exe "normal 7|c$\<Esc>"
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
599 call assert_equal('xonex ', getline(1))
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
600 call assert_equal(expected[:0], prop_list(1))
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
601 " Linewise.
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
602 exe "normal cc\<Esc>"
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
603 call assert_equal('', getline(1))
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
604 call assert_equal([], prop_list(1))
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
605
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
606 call DeletePropTypes()
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
607 bwipe!
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
608 set bs&
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
609 endfunc
77a00aa3e215 patch 8.2.4944: text properties are wrong after "cc"
Bram Moolenaar <Bram@vim.org>
parents: 28526
diff changeset
610
15349
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
611 func Test_prop_replace()
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
612 new
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
613 set bs=2
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
614 let expected = SetupOneLine() " 'xonex xtwoxx'
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
615
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
616 exe "normal 0Ryyy\<Esc>"
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
617 call assert_equal('yyyex xtwoxx', getline(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
618 call assert_equal(expected, prop_list(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
619
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
620 exe "normal ftRyy\<BS>"
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
621 call assert_equal('yyyex xywoxx', getline(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
622 call assert_equal(expected, prop_list(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
623
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
624 exe "normal 0fwRyy\<BS>"
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
625 call assert_equal('yyyex xyyoxx', getline(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
626 call assert_equal(expected, prop_list(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
627
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
628 exe "normal 0foRyy\<BS>\<BS>"
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
629 call assert_equal('yyyex xyyoxx', getline(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
630 call assert_equal(expected, prop_list(1))
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
631
28931
b57caac54649 patch 8.2.4988: textprop in wrong position when replacing multi-byte chars
Bram Moolenaar <Bram@vim.org>
parents: 28875
diff changeset
632 " Replace three 1-byte chars with three 2-byte ones.
b57caac54649 patch 8.2.4988: textprop in wrong position when replacing multi-byte chars
Bram Moolenaar <Bram@vim.org>
parents: 28875
diff changeset
633 exe "normal 0l3rø"
b57caac54649 patch 8.2.4988: textprop in wrong position when replacing multi-byte chars
Bram Moolenaar <Bram@vim.org>
parents: 28875
diff changeset
634 call assert_equal('yøøøx xyyoxx', getline(1))
b57caac54649 patch 8.2.4988: textprop in wrong position when replacing multi-byte chars
Bram Moolenaar <Bram@vim.org>
parents: 28875
diff changeset
635 let expected[0].length += 3
b57caac54649 patch 8.2.4988: textprop in wrong position when replacing multi-byte chars
Bram Moolenaar <Bram@vim.org>
parents: 28875
diff changeset
636 let expected[1].col += 3
b57caac54649 patch 8.2.4988: textprop in wrong position when replacing multi-byte chars
Bram Moolenaar <Bram@vim.org>
parents: 28875
diff changeset
637 call assert_equal(expected, prop_list(1))
b57caac54649 patch 8.2.4988: textprop in wrong position when replacing multi-byte chars
Bram Moolenaar <Bram@vim.org>
parents: 28875
diff changeset
638
15349
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
639 call DeletePropTypes()
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
640 bwipe!
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
641 set bs&
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
642 endfunc
6abee072b93c patch 8.1.0682: text properties not adjusted when backspacing replaced text
Bram Moolenaar <Bram@vim.org>
parents: 15347
diff changeset
643
16662
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
644 func Test_prop_open_line()
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
645 new
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
646
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
647 " open new line, props stay in top line
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
648 let expected = SetupOneLine() " 'xonex xtwoxx'
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
649 exe "normal o\<Esc>"
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
650 call assert_equal('xonex xtwoxx', getline(1))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
651 call assert_equal('', getline(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
652 call assert_equal(expected, prop_list(1))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
653 call DeletePropTypes()
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
654
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
655 " move all props to next line
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
656 let expected = SetupOneLine() " 'xonex xtwoxx'
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
657 exe "normal 0i\<CR>\<Esc>"
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
658 call assert_equal('', getline(1))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
659 call assert_equal('xonex xtwoxx', getline(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
660 call assert_equal(expected, prop_list(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
661 call DeletePropTypes()
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
662
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
663 " split just before prop, move all props to next line
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
664 let expected = SetupOneLine() " 'xonex xtwoxx'
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
665 exe "normal 0li\<CR>\<Esc>"
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
666 call assert_equal('x', getline(1))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
667 call assert_equal('onex xtwoxx', getline(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
668 let expected[0].col -= 1
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
669 let expected[1].col -= 1
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
670 call assert_equal(expected, prop_list(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
671 call DeletePropTypes()
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
672
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
673 " split inside prop, split first prop
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
674 let expected = SetupOneLine() " 'xonex xtwoxx'
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
675 exe "normal 0lli\<CR>\<Esc>"
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
676 call assert_equal('xo', getline(1))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
677 call assert_equal('nex xtwoxx', getline(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
678 let exp_first = [deepcopy(expected[0])]
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
679 let exp_first[0].length = 1
20583
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
680 let exp_first[0].end = 0
16662
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
681 call assert_equal(exp_first, prop_list(1))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
682 let expected[0].col = 1
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
683 let expected[0].length = 2
20583
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
684 let expected[0].start = 0
16662
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
685 let expected[1].col -= 2
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
686 call assert_equal(expected, prop_list(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
687 call DeletePropTypes()
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
688
16670
5733d8e33bce patch 8.1.1337: get empty text prop when splitting line just after text prop
Bram Moolenaar <Bram@vim.org>
parents: 16662
diff changeset
689 " split just after first prop, second prop move to next line
16662
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
690 let expected = SetupOneLine() " 'xonex xtwoxx'
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
691 exe "normal 0fea\<CR>\<Esc>"
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
692 call assert_equal('xone', getline(1))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
693 call assert_equal('x xtwoxx', getline(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
694 let exp_first = expected[0:0]
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
695 call assert_equal(exp_first, prop_list(1))
16670
5733d8e33bce patch 8.1.1337: get empty text prop when splitting line just after text prop
Bram Moolenaar <Bram@vim.org>
parents: 16662
diff changeset
696 let expected = expected[1:1]
5733d8e33bce patch 8.1.1337: get empty text prop when splitting line just after text prop
Bram Moolenaar <Bram@vim.org>
parents: 16662
diff changeset
697 let expected[0].col -= 4
16662
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
698 call assert_equal(expected, prop_list(2))
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
699 call DeletePropTypes()
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
700
28865
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
701 " split at the space character with 'ai' active, the leading space is removed
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
702 " in the second line and the prop is shifted accordingly.
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
703 let expected = SetupOneLine() " 'xonex xtwoxx'
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
704 set ai
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
705 exe "normal 6|i\<CR>\<Esc>"
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
706 call assert_equal('xonex', getline(1))
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
707 call assert_equal('xtwoxx', getline(2))
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
708 let expected[1].col -= 6
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
709 call assert_equal(expected, prop_list(1) + prop_list(2))
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
710 set ai&
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
711 call DeletePropTypes()
a04815de0bd3 patch 8.2.4955: text property in wrong position after auto-indent
Bram Moolenaar <Bram@vim.org>
parents: 28863
diff changeset
712
16662
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
713 bwipe!
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
714 set bs&
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
715 endfunc
1fc9cd08cf3c patch 8.1.1333: text properties don't always move after changes
Bram Moolenaar <Bram@vim.org>
parents: 16545
diff changeset
716
29645
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
717 func Test_prop_put()
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
718 new
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
719 let expected = SetupOneLine() " 'xonex xtwoxx'
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
720
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
721 let @a = 'new'
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
722 " insert just after the prop
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
723 normal 03l"ap
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
724 " insert inside the prop
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
725 normal 02l"ap
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
726 " insert just before the prop
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
727 normal 0"ap
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
728
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
729 call assert_equal('xnewonnewenewx xtwoxx', getline(1))
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
730 let expected[0].col += 3
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
731 let expected[0].length += 3
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
732 let expected[1].col += 9
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
733 call assert_equal(expected, prop_list(1))
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
734
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
735 " Visually select 4 chars in the prop and put "AB" to replace them
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
736 let @a = 'AB'
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
737 normal 05lv3l"ap
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
738 call assert_equal('xnewoABenewx xtwoxx', getline(1))
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
739 let expected[0].length -= 2
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
740 let expected[1].col -= 2
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
741 call assert_equal(expected, prop_list(1))
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
742
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
743 call DeletePropTypes()
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
744 bwipe!
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
745 endfunc
9cd050914eb6 patch 9.0.0163: text property not adjusted for text inserted with "p"
Bram Moolenaar <Bram@vim.org>
parents: 29643
diff changeset
746
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
747 func Test_prop_clear()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
748 new
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
749 call AddPropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
750 call SetupPropsInFirstLine()
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
751 call assert_equal(Get_expected_props(), prop_list(1))
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
752
17980
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
753 eval 1->prop_clear()
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
754 call assert_equal([], 1->prop_list())
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
755
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
756 call DeletePropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
757 bwipe!
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
758 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
759
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
760 func Test_prop_clear_buf()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
761 new
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
762 call AddPropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
763 call SetupPropsInFirstLine()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
764 let bufnr = bufnr('')
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
765 wincmd w
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
766 call assert_equal(Get_expected_props(), prop_list(1, {'bufnr': bufnr}))
15138
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
767
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
768 call prop_clear(1, 1, {'bufnr': bufnr})
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
769 call assert_equal([], prop_list(1, {'bufnr': bufnr}))
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
770
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
771 wincmd w
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
772 call DeletePropTypes()
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
773 bwipe!
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
774 endfunc
9df130fd5e0d patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
775
15365
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
776 func Test_prop_setline()
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
777 new
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
778 call AddPropTypes()
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
779 call SetupPropsInFirstLine()
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
780 call assert_equal(Get_expected_props(), prop_list(1))
15365
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
781
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
782 call setline(1, 'foobar')
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
783 call assert_equal([], prop_list(1))
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
784
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
785 call DeletePropTypes()
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
786 bwipe!
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
787 endfunc
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
788
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
789 func Test_prop_setbufline()
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
790 new
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
791 call AddPropTypes()
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
792 call SetupPropsInFirstLine()
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
793 let bufnr = bufnr('')
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
794 wincmd w
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
795 call assert_equal(Get_expected_props(), prop_list(1, {'bufnr': bufnr}))
15365
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
796
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
797 call setbufline(bufnr, 1, 'foobar')
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
798 call assert_equal([], prop_list(1, {'bufnr': bufnr}))
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
799
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
800 wincmd w
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
801 call DeletePropTypes()
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
802 bwipe!
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
803 endfunc
01ee8dc12313 patch 8.1.0690: setline() and setbufline() do not clear text properties
Bram Moolenaar <Bram@vim.org>
parents: 15363
diff changeset
804
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
805 func Test_prop_substitute()
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
806 new
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
807 " Set first line to 'one two three'
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
808 call AddPropTypes()
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
809 call SetupPropsInFirstLine()
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
810 let expected_props = Get_expected_props()
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
811 call assert_equal(expected_props, prop_list(1))
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
812
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
813 " Change "n" in "one" to XX: 'oXXe two three'
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
814 s/n/XX/
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
815 let expected_props[0].length += 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
816 let expected_props[1].length += 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
817 let expected_props[2].col += 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
818 let expected_props[3].col += 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
819 call assert_equal(expected_props, prop_list(1))
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
820
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
821 " Delete "t" in "two" and "three" to XX: 'oXXe wo hree'
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
822 s/t//g
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
823 let expected_props[0].length -= 2
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
824 let expected_props[2].length -= 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
825 let expected_props[3].length -= 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
826 let expected_props[3].col -= 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
827 call assert_equal(expected_props, prop_list(1))
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
828
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
829 " Split the line by changing w to line break: 'oXXe ', 'o hree'
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
830 " The long prop is split and spans both lines.
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
831 " The props on "two" and "three" move to the next line.
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
832 s/w/\r/
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
833 let new_props = [
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
834 \ copy(expected_props[0]),
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
835 \ copy(expected_props[2]),
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
836 \ copy(expected_props[3]),
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
837 \ ]
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
838 let expected_props[0].length = 5
20583
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
839 let expected_props[0].end = 0
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
840 unlet expected_props[3]
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
841 unlet expected_props[2]
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
842 call assert_equal(expected_props, prop_list(1))
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
843
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
844 let new_props[0].length = 6
20583
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
845 let new_props[0].start = 0
15367
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
846 let new_props[1].col = 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
847 let new_props[1].length = 1
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
848 let new_props[2].col = 3
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
849 call assert_equal(new_props, prop_list(2))
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
850
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
851 call DeletePropTypes()
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
852 bwipe!
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
853 endfunc
273649cad196 patch 8.1.0691: text properties are not adjusted for :substitute
Bram Moolenaar <Bram@vim.org>
parents: 15365
diff changeset
854
15398
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
855 func Test_prop_change_indent()
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
856 call prop_type_add('comment', {'highlight': 'Directory'})
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
857 new
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
858 call setline(1, [' xxx', 'yyyyy'])
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
859 call prop_add(2, 2, {'length': 2, 'type': 'comment'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
860 let expect = #{type_bufnr: 0, col: 2, length: 2, type: 'comment', start: 1, end: 1, id: 0}
15398
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
861 call assert_equal([expect], prop_list(2))
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
862
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
863 set shiftwidth=3
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
864 normal 2G>>
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
865 call assert_equal(' yyyyy', getline(2))
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
866 let expect.col += 3
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
867 call assert_equal([expect], prop_list(2))
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
868
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
869 normal 2G==
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
870 call assert_equal(' yyyyy', getline(2))
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
871 let expect.col = 6
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
872 call assert_equal([expect], prop_list(2))
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
873
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
874 call prop_clear(2)
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
875 call prop_add(2, 2, {'length': 5, 'type': 'comment'})
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
876 let expect.col = 2
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
877 let expect.length = 5
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
878 call assert_equal([expect], prop_list(2))
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
879
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
880 normal 2G<<
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
881 call assert_equal(' yyyyy', getline(2))
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
882 let expect.length = 2
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
883 call assert_equal([expect], prop_list(2))
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
884
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
885 set shiftwidth&
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
886 call prop_type_delete('comment')
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
887 endfunc
3e02464faaac patch 8.1.0707: text property columns are not adjusted for changed indent
Bram Moolenaar <Bram@vim.org>
parents: 15367
diff changeset
888
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
889 " Setup a three line prop in lines 2 - 4.
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
890 " Add short props in line 1 and 5.
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
891 func Setup_three_line_prop()
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
892 new
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
893 call setline(1, ['one', 'twotwo', 'three', 'fourfour', 'five'])
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
894 call prop_add(1, 2, {'length': 1, 'type': 'comment'})
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
895 call prop_add(2, 4, {'end_lnum': 4, 'end_col': 5, 'type': 'comment'})
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
896 call prop_add(5, 2, {'length': 1, 'type': 'comment'})
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
897 endfunc
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
898
15251
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
899 func Test_prop_multiline()
17980
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
900 eval 'comment'->prop_type_add({'highlight': 'Directory'})
15251
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
901 new
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
902 call setline(1, ['xxxxxxx', 'yyyyyyyyy', 'zzzzzzzz'])
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
903
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
904 " start halfway line 1, end halfway line 3
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
905 call prop_add(1, 3, {'end_lnum': 3, 'end_col': 5, 'type': 'comment'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
906 let expect1 = #{type_bufnr: 0, col: 3, length: 6, type: 'comment', start: 1, end: 0, id: 0}
15251
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
907 call assert_equal([expect1], prop_list(1))
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
908 let expect2 = #{type_bufnr: 0, col: 1, length: 10, type: 'comment', start: 0, end: 0, id: 0}
15251
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
909 call assert_equal([expect2], prop_list(2))
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
910 let expect3 = #{type_bufnr: 0, col: 1, length: 4, type: 'comment', start: 0, end: 1, id: 0}
15251
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
911 call assert_equal([expect3], prop_list(3))
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
912 call prop_clear(1, 3)
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
913
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
914 " include all three lines
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
915 call prop_add(1, 1, {'end_lnum': 3, 'end_col': 999, 'type': 'comment'})
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
916 let expect1.col = 1
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
917 let expect1.length = 8
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
918 call assert_equal([expect1], prop_list(1))
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
919 call assert_equal([expect2], prop_list(2))
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
920 let expect3.length = 9
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
921 call assert_equal([expect3], prop_list(3))
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
922 call prop_clear(1, 3)
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
923
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
924 bwipe!
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
925
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
926 " Test deleting the first line of a multi-line prop.
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
927 call Setup_three_line_prop()
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
928 let expect_short = #{type_bufnr: 0, col: 2, length: 1, type: 'comment', start: 1, end: 1, id: 0}
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
929 call assert_equal([expect_short], prop_list(1))
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
930 let expect2 = #{type_bufnr: 0, col: 4, length: 4, type: 'comment', start: 1, end: 0, id: 0}
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
931 call assert_equal([expect2], prop_list(2))
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
932 2del
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
933 call assert_equal([expect_short], prop_list(1))
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
934 let expect2 = #{type_bufnr: 0, col: 1, length: 6, type: 'comment', start: 1, end: 0, id: 0}
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
935 call assert_equal([expect2], prop_list(2))
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
936 bwipe!
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
937
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
938 " Test deleting the last line of a multi-line prop.
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
939 call Setup_three_line_prop()
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
940 let expect3 = #{type_bufnr: 0, col: 1, length: 6, type: 'comment', start: 0, end: 0, id: 0}
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
941 call assert_equal([expect3], prop_list(3))
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
942 let expect4 = #{type_bufnr: 0, col: 1, length: 4, type: 'comment', start: 0, end: 1, id: 0}
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
943 call assert_equal([expect4], prop_list(4))
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
944 4del
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
945 let expect3.end = 1
15292
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
946 call assert_equal([expect3], prop_list(3))
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
947 call assert_equal([expect_short], prop_list(4))
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
948 bwipe!
ba6f0f1bb9d0 patch 8.1.0654: when deleting a line text property flags are not adjusted
Bram Moolenaar <Bram@vim.org>
parents: 15269
diff changeset
949
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
950 " Test appending a line below the multi-line text prop start.
15294
2d8225cc1315 patch 8.1.0655: when appending a line text property flags are not added
Bram Moolenaar <Bram@vim.org>
parents: 15292
diff changeset
951 call Setup_three_line_prop()
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
952 let expect2 = #{type_bufnr: 0, col: 4, length: 4, type: 'comment', start: 1, end: 0, id: 0}
15294
2d8225cc1315 patch 8.1.0655: when appending a line text property flags are not added
Bram Moolenaar <Bram@vim.org>
parents: 15292
diff changeset
953 call assert_equal([expect2], prop_list(2))
2d8225cc1315 patch 8.1.0655: when appending a line text property flags are not added
Bram Moolenaar <Bram@vim.org>
parents: 15292
diff changeset
954 call append(2, "new line")
2d8225cc1315 patch 8.1.0655: when appending a line text property flags are not added
Bram Moolenaar <Bram@vim.org>
parents: 15292
diff changeset
955 call assert_equal([expect2], prop_list(2))
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
956 let expect3 = #{type_bufnr: 0, col: 1, length: 9, type: 'comment', start: 0, end: 0, id: 0}
15294
2d8225cc1315 patch 8.1.0655: when appending a line text property flags are not added
Bram Moolenaar <Bram@vim.org>
parents: 15292
diff changeset
957 call assert_equal([expect3], prop_list(3))
2d8225cc1315 patch 8.1.0655: when appending a line text property flags are not added
Bram Moolenaar <Bram@vim.org>
parents: 15292
diff changeset
958 bwipe!
2d8225cc1315 patch 8.1.0655: when appending a line text property flags are not added
Bram Moolenaar <Bram@vim.org>
parents: 15292
diff changeset
959
15251
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
960 call prop_type_delete('comment')
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
961 endfunc
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
962
29657
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
963 func Run_test_with_line2byte(add_props)
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
964 new
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
965 setlocal ff=unix
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
966 if a:add_props
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
967 call prop_type_add('textprop', #{highlight: 'Search'})
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
968 endif
29682
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
969 " Add a text prop to every fourth line and then change every fifth line so
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
970 " that it causes a data block split a few times.
29657
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
971 for nr in range(1, 1000)
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
972 call setline(nr, 'some longer text here')
29682
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
973 if a:add_props && nr % 4 == 0
29657
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
974 call prop_add(nr, 13, #{type: 'textprop', length: 4})
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
975 endif
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
976 endfor
29682
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
977 let expected = 22 * 997 + 1
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
978 call assert_equal(expected, line2byte(998))
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
979
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
980 for nr in range(1, 1000, 5)
29657
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
981 exe nr .. "s/longer/much more/"
29682
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
982 let expected += 3
57cfb39b7842 patch 9.0.0181: textprop test with line2byte() fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29680
diff changeset
983 call assert_equal(expected, line2byte(998), 'line ' .. nr)
29657
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
984 endfor
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
985
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
986 if a:add_props
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
987 call prop_type_delete('textprop')
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
988 endif
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
989 bwipe!
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
990 endfunc
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
991
19110
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
992 func Test_prop_line2byte()
15255
19e79a1ed6b6 patch 8.1.0636: line2byte() gives wrong values with text properties
Bram Moolenaar <Bram@vim.org>
parents: 15251
diff changeset
993 call prop_type_add('comment', {'highlight': 'Directory'})
19e79a1ed6b6 patch 8.1.0636: line2byte() gives wrong values with text properties
Bram Moolenaar <Bram@vim.org>
parents: 15251
diff changeset
994 new
15269
27783a6f430b patch 8.1.0643: computing byte offset wrong
Bram Moolenaar <Bram@vim.org>
parents: 15261
diff changeset
995 call setline(1, ['line1', 'second line', ''])
15261
c5cb5151940d patch 8.1.0639: text properties test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 15255
diff changeset
996 set ff=unix
15269
27783a6f430b patch 8.1.0643: computing byte offset wrong
Bram Moolenaar <Bram@vim.org>
parents: 15261
diff changeset
997 call assert_equal(19, line2byte(3))
15255
19e79a1ed6b6 patch 8.1.0636: line2byte() gives wrong values with text properties
Bram Moolenaar <Bram@vim.org>
parents: 15251
diff changeset
998 call prop_add(1, 1, {'end_col': 3, 'type': 'comment'})
15269
27783a6f430b patch 8.1.0643: computing byte offset wrong
Bram Moolenaar <Bram@vim.org>
parents: 15261
diff changeset
999 call assert_equal(19, line2byte(3))
25624
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1000 bwipe!
15255
19e79a1ed6b6 patch 8.1.0636: line2byte() gives wrong values with text properties
Bram Moolenaar <Bram@vim.org>
parents: 15251
diff changeset
1001
25624
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1002 new
25628
0407a3db3ef6 patch 8.2.3350: text properties test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 25624
diff changeset
1003 setlocal ff=unix
25624
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1004 call setline(1, range(500))
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1005 call assert_equal(1491, line2byte(401))
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1006 call prop_add(2, 1, {'type': 'comment'})
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1007 call prop_add(222, 1, {'type': 'comment'})
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1008 call assert_equal(1491, line2byte(401))
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1009 call prop_remove({'type': 'comment'})
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1010 call assert_equal(1491, line2byte(401))
15255
19e79a1ed6b6 patch 8.1.0636: line2byte() gives wrong values with text properties
Bram Moolenaar <Bram@vim.org>
parents: 15251
diff changeset
1011 bwipe!
25624
0ef8ef1af478 patch 8.2.3348: line2byte() returns wrong value after adding textprop
Bram Moolenaar <Bram@vim.org>
parents: 25471
diff changeset
1012
25672
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1013 new
25674
1d14b5d3de17 patch 8.2.3373: text property test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 25672
diff changeset
1014 setlocal ff=unix
25672
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1015 call setline(1, range(520))
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1016 call assert_equal(1491, line2byte(401))
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1017 call prop_add(2, 1, {'type': 'comment'})
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1018 call assert_equal(1491, line2byte(401))
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1019 2delete
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1020 call assert_equal(1489, line2byte(400))
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1021 bwipe!
ab42c36d1a27 patch 8.2.3372: line2byte() value wrong when adding a text property
Bram Moolenaar <Bram@vim.org>
parents: 25640
diff changeset
1022
29657
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
1023 " Add many lines so that the data block is split.
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
1024 " With and without props should give the same result.
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
1025 call Run_test_with_line2byte(0)
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
1026 call Run_test_with_line2byte(1)
b90b037e80be patch 9.0.0169: insufficient testing for line2byte() with text properties
Bram Moolenaar <Bram@vim.org>
parents: 29655
diff changeset
1027
15255
19e79a1ed6b6 patch 8.1.0636: line2byte() gives wrong values with text properties
Bram Moolenaar <Bram@vim.org>
parents: 15251
diff changeset
1028 call prop_type_delete('comment')
19e79a1ed6b6 patch 8.1.0636: line2byte() gives wrong values with text properties
Bram Moolenaar <Bram@vim.org>
parents: 15251
diff changeset
1029 endfunc
19e79a1ed6b6 patch 8.1.0636: line2byte() gives wrong values with text properties
Bram Moolenaar <Bram@vim.org>
parents: 15251
diff changeset
1030
19110
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1031 func Test_prop_byte2line()
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1032 new
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1033 set ff=unix
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1034 call setline(1, ['one one', 'two two', 'three three', 'four four', 'five'])
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1035 call assert_equal(4, byte2line(line2byte(4)))
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1036 call assert_equal(5, byte2line(line2byte(5)))
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1037
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1038 call prop_type_add('prop', {'highlight': 'Directory'})
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1039 call prop_add(3, 1, {'length': 5, 'type': 'prop'})
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1040 call assert_equal(4, byte2line(line2byte(4)))
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1041 call assert_equal(5, byte2line(line2byte(5)))
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1042
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1043 bwipe!
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1044 call prop_type_delete('prop')
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1045 endfunc
e40814841406 patch 8.2.0115: byte2line() does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 19100
diff changeset
1046
23776
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1047 func Test_prop_goto_byte()
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1048 new
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1049 call setline(1, '')
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1050 call setline(2, 'two three')
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1051 call setline(3, '')
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1052 call setline(4, 'four five')
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1053
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1054 call prop_type_add('testprop', {'highlight': 'Directory'})
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1055 call search('^two')
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1056 call prop_add(line('.'), col('.'), {
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1057 \ 'length': len('two'),
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1058 \ 'type': 'testprop'
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1059 \ })
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1060
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1061 call search('two \zsthree')
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1062 let expected_pos = line2byte(line('.')) + col('.') - 1
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1063 exe expected_pos .. 'goto'
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1064 let actual_pos = line2byte(line('.')) + col('.') - 1
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1065 eval actual_pos->assert_equal(expected_pos)
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1066
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1067 call search('four \zsfive')
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1068 let expected_pos = line2byte(line('.')) + col('.') - 1
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1069 exe expected_pos .. 'goto'
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1070 let actual_pos = line2byte(line('.')) + col('.') - 1
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1071 eval actual_pos->assert_equal(expected_pos)
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1072
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1073 call prop_type_delete('testprop')
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1074 bwipe!
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1075 endfunc
9f692a75d481 patch 8.2.2429: :goto does not work correctly with text properties
Bram Moolenaar <Bram@vim.org>
parents: 23306
diff changeset
1076
15363
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1077 func Test_prop_undo()
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1078 new
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1079 call prop_type_add('comment', {'highlight': 'Directory'})
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1080 call setline(1, ['oneone', 'twotwo', 'three'])
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1081 " Set 'undolevels' to break changes into undo-able pieces.
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1082 set ul&
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1083
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1084 call prop_add(1, 3, {'end_col': 5, 'type': 'comment'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1085 let expected = [#{type_bufnr: 0, col: 3, length: 2, id: 0, type: 'comment', start: 1, end: 1}]
15363
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1086 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1087
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1088 " Insert a character, then undo.
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1089 exe "normal 0lllix\<Esc>"
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1090 set ul&
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1091 let expected[0].length = 3
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1092 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1093 undo
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1094 let expected[0].length = 2
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1095 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1096
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1097 " Delete a character, then undo
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1098 exe "normal 0lllx"
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1099 set ul&
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1100 let expected[0].length = 1
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1101 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1102 undo
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1103 let expected[0].length = 2
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1104 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1105
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1106 " Delete the line, then undo
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1107 1d
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1108 set ul&
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1109 call assert_equal([], prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1110 undo
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1111 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1112
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1113 " Insert a character, delete two characters, then undo with "U"
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1114 exe "normal 0lllix\<Esc>"
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1115 set ul&
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1116 let expected[0].length = 3
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1117 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1118 exe "normal 0lllxx"
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1119 set ul&
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1120 let expected[0].length = 1
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1121 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1122 normal U
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1123 let expected[0].length = 2
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1124 call assert_equal(expected, prop_list(1))
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1125
16698
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1126 " substitute a word, then undo
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1127 call setline(1, 'the number 123 is highlighted.')
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1128 call prop_add(1, 12, {'length': 3, 'type': 'comment'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1129 let expected = [#{type_bufnr: 0, col: 12, length: 3, id: 0, type: 'comment', start: 1, end: 1} ]
16698
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1130 call assert_equal(expected, prop_list(1))
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1131 set ul&
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1132 1s/number/foo
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1133 let expected[0].col = 9
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1134 call assert_equal(expected, prop_list(1))
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1135 undo
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1136 let expected[0].col = 12
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1137 call assert_equal(expected, prop_list(1))
16714
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1138 call prop_clear(1)
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1139
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1140 " substitute with backslash
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1141 call setline(1, 'the number 123 is highlighted.')
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1142 call prop_add(1, 12, {'length': 3, 'type': 'comment'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1143 let expected = [#{type_bufnr: 0, col: 12, length: 3, id: 0, type: 'comment', start: 1, end: 1} ]
16714
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1144 call assert_equal(expected, prop_list(1))
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1145 1s/the/\The
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1146 call assert_equal(expected, prop_list(1))
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1147 1s/^/\\
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1148 let expected[0].col += 1
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1149 call assert_equal(expected, prop_list(1))
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1150 1s/^/\~
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1151 let expected[0].col += 1
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1152 call assert_equal(expected, prop_list(1))
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1153 1s/123/12\\3
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1154 let expected[0].length += 1
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1155 call assert_equal(expected, prop_list(1))
ba592f30c082 patch 8.1.1359: text property wrong after :substitute with backslash
Bram Moolenaar <Bram@vim.org>
parents: 16698
diff changeset
1156 call prop_clear(1)
16698
23af483c4ceb patch 8.1.1351: text property wrong after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 16682
diff changeset
1157
15363
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1158 bwipe!
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1159 call prop_type_delete('comment')
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1160 endfunc
45f36b66a032 patch 8.1.0689: undo with text properties not tested
Bram Moolenaar <Bram@vim.org>
parents: 15349
diff changeset
1161
18631
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1162 func Test_prop_delete_text()
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1163 new
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1164 call prop_type_add('comment', {'highlight': 'Directory'})
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1165 call setline(1, ['oneone', 'twotwo', 'three'])
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1166
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1167 " zero length property
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1168 call prop_add(1, 3, {'type': 'comment'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1169 let expected = [#{type_bufnr: 0, col: 3, length: 0, id: 0, type: 'comment', start: 1, end: 1} ]
18631
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1170 call assert_equal(expected, prop_list(1))
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1171
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1172 " delete one char moves the property
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1173 normal! x
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1174 let expected = [#{type_bufnr: 0, col: 2, length: 0, id: 0, type: 'comment', start: 1, end: 1} ]
18631
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1175 call assert_equal(expected, prop_list(1))
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1176
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1177 " delete char of the property has no effect
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1178 normal! lx
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1179 let expected = [#{type_bufnr: 0, col: 2, length: 0, id: 0, type: 'comment', start: 1, end: 1} ]
18631
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1180 call assert_equal(expected, prop_list(1))
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1181
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1182 " delete more chars moves property to first column, is not deleted
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1183 normal! 0xxxx
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1184 let expected = [#{type_bufnr: 0, col: 1, length: 0, id: 0, type: 'comment', start: 1, end: 1} ]
18631
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1185 call assert_equal(expected, prop_list(1))
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1186
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1187 bwipe!
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1188 call prop_type_delete('comment')
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1189 endfunc
e2d9f4d030fa patch 8.1.2308: deleting text before zero-width textprop removes it
Bram Moolenaar <Bram@vim.org>
parents: 18605
diff changeset
1190
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1191 " screenshot test with textprop highlighting
16682
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1192 func Test_textprop_screenshot_various()
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1193 CheckScreendump
15928
857ce36c8412 patch 8.1.0970: text properties test fails when 'encoding' is not utf-8
Bram Moolenaar <Bram@vim.org>
parents: 15398
diff changeset
1194 " The Vim running in the terminal needs to use utf-8.
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1195 if g:orig_encoding != 'utf-8'
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1196 throw 'Skipped: not using utf-8'
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1197 endif
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1198 call writefile([
16545
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1199 \ "call setline(1, ["
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1200 \ .. "'One two',"
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1201 \ .. "'Numbér 123 änd thœn 4¾7.',"
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1202 \ .. "'--aa--bb--cc--dd--',"
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1203 \ .. "'// comment with error in it',"
16678
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1204 \ .. "'first line',"
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1205 \ .. "' second line ',"
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1206 \ .. "'third line',"
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1207 \ .. "' fourth line',"
16545
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1208 \ .. "])",
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1209 \ "hi NumberProp ctermfg=blue",
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1210 \ "hi LongProp ctermbg=yellow",
16545
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1211 \ "hi BackgroundProp ctermbg=lightgrey",
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1212 \ "hi UnderlineProp cterm=underline",
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1213 \ "call prop_type_add('number', {'highlight': 'NumberProp'})",
17980
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
1214 \ "call prop_type_add('long', {'highlight': 'NumberProp'})",
52f23198af7f patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17694
diff changeset
1215 \ "call prop_type_change('long', {'highlight': 'LongProp'})",
15341
03a7a9fdb792 patch 8.1.0678: text properties as not adjusted for inserted text
Bram Moolenaar <Bram@vim.org>
parents: 15335
diff changeset
1216 \ "call prop_type_add('start', {'highlight': 'NumberProp', 'start_incl': 1})",
03a7a9fdb792 patch 8.1.0678: text properties as not adjusted for inserted text
Bram Moolenaar <Bram@vim.org>
parents: 15335
diff changeset
1217 \ "call prop_type_add('end', {'highlight': 'NumberProp', 'end_incl': 1})",
03a7a9fdb792 patch 8.1.0678: text properties as not adjusted for inserted text
Bram Moolenaar <Bram@vim.org>
parents: 15335
diff changeset
1218 \ "call prop_type_add('both', {'highlight': 'NumberProp', 'start_incl': 1, 'end_incl': 1})",
18570
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18444
diff changeset
1219 \ "call prop_type_add('background', {'highlight': 'BackgroundProp', 'combine': 0})",
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18444
diff changeset
1220 \ "call prop_type_add('backgroundcomb', {'highlight': 'NumberProp', 'combine': 1})",
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18444
diff changeset
1221 \ "eval 'backgroundcomb'->prop_type_change({'highlight': 'BackgroundProp'})",
18605
63d855ad505c patch 8.1.2296: text properties are not combined with syntax by default
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1222 \ "call prop_type_add('error', {'highlight': 'UnderlineProp'})",
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1223 \ "call prop_add(1, 4, {'end_lnum': 3, 'end_col': 3, 'type': 'long'})",
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
1224 \ "call prop_add(2, 9, {'length': 3, 'type': 'number'})",
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
1225 \ "call prop_add(2, 24, {'length': 4, 'type': 'number'})",
15341
03a7a9fdb792 patch 8.1.0678: text properties as not adjusted for inserted text
Bram Moolenaar <Bram@vim.org>
parents: 15335
diff changeset
1226 \ "call prop_add(3, 3, {'length': 2, 'type': 'number'})",
03a7a9fdb792 patch 8.1.0678: text properties as not adjusted for inserted text
Bram Moolenaar <Bram@vim.org>
parents: 15335
diff changeset
1227 \ "call prop_add(3, 7, {'length': 2, 'type': 'start'})",
03a7a9fdb792 patch 8.1.0678: text properties as not adjusted for inserted text
Bram Moolenaar <Bram@vim.org>
parents: 15335
diff changeset
1228 \ "call prop_add(3, 11, {'length': 2, 'type': 'end'})",
03a7a9fdb792 patch 8.1.0678: text properties as not adjusted for inserted text
Bram Moolenaar <Bram@vim.org>
parents: 15335
diff changeset
1229 \ "call prop_add(3, 15, {'length': 2, 'type': 'both'})",
18570
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18444
diff changeset
1230 \ "call prop_add(4, 6, {'length': 3, 'type': 'background'})",
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18444
diff changeset
1231 \ "call prop_add(4, 12, {'length': 10, 'type': 'backgroundcomb'})",
16545
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1232 \ "call prop_add(4, 17, {'length': 5, 'type': 'error'})",
16678
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1233 \ "call prop_add(5, 7, {'length': 4, 'type': 'long'})",
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1234 \ "call prop_add(6, 1, {'length': 8, 'type': 'long'})",
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1235 \ "call prop_add(8, 1, {'length': 1, 'type': 'long'})",
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1236 \ "call prop_add(8, 11, {'length': 4, 'type': 'long'})",
16676
79c5f723bb5d patch 8.1.1340: attributes from 'cursorline' overwrite textprop
Bram Moolenaar <Bram@vim.org>
parents: 16670
diff changeset
1237 \ "set number cursorline",
15335
18c20ceee4b5 patch 8.1.0675: text property column in screen columns is not practical
Bram Moolenaar <Bram@vim.org>
parents: 15318
diff changeset
1238 \ "hi clear SpellBad",
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1239 \ "set spell",
16545
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1240 \ "syn match Comment '//.*'",
7a563ee902b6 patch 8.1.1276: cannot combine text properties with syntax highlighting
Bram Moolenaar <Bram@vim.org>
parents: 16060
diff changeset
1241 \ "hi Comment ctermfg=green",
15341
03a7a9fdb792 patch 8.1.0678: text properties as not adjusted for inserted text
Bram Moolenaar <Bram@vim.org>
parents: 15335
diff changeset
1242 \ "normal 3G0llix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>lllix\<Esc>",
15347
f6b522596993 patch 8.1.0681: text properties as not adjusted for deleted text
Bram Moolenaar <Bram@vim.org>
parents: 15341
diff changeset
1243 \ "normal 3G0lli\<BS>\<Esc>",
16678
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1244 \ "normal 6G0i\<BS>\<Esc>",
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1245 \ "normal 3J",
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1246 \ "normal 3G",
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
1247 \], 'XtestProp', 'D')
16678
6f453673eb19 patch 8.1.1341: text properties are lost when joining lines
Bram Moolenaar <Bram@vim.org>
parents: 16676
diff changeset
1248 let buf = RunVimInTerminal('-S XtestProp', {'rows': 8})
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1249 call VerifyScreenDump(buf, 'Test_textprop_01', {})
15251
17525ca95e1e patch 8.1.0634: text properties cannot cross line boundaries
Bram Moolenaar <Bram@vim.org>
parents: 15138
diff changeset
1250
15314
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1251 " clean up
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1252 call StopVimInTerminal(buf)
c4d62945d96f patch 8.1.0665: text property display wrong when 'spell' is set
Bram Moolenaar <Bram@vim.org>
parents: 15294
diff changeset
1253 endfunc
16682
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1254
29607
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1255 func Test_textprop_hl_override()
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1256 CheckScreendump
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1257
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1258 let lines =<< trim END
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1259 call setline(1, ['One one one one one', 'Two two two two two', 'Three three three three'])
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1260 hi OverProp ctermfg=blue ctermbg=yellow
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1261 hi CursorLine cterm=bold,underline ctermfg=red ctermbg=green
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1262 hi Vsual ctermfg=cyan ctermbg=grey
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1263 call prop_type_add('under', #{highlight: 'OverProp'})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1264 call prop_type_add('over', #{highlight: 'OverProp', override: 1})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1265 call prop_add(1, 5, #{type: 'under', length: 4})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1266 call prop_add(1, 13, #{type: 'over', length: 4})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1267 call prop_add(2, 5, #{type: 'under', length: 4})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1268 call prop_add(2, 13, #{type: 'over', length: 4})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1269 call prop_add(3, 5, #{type: 'under', length: 4})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1270 call prop_add(3, 13, #{type: 'over', length: 4})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1271 set cursorline
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1272 2
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1273 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
1274 call writefile(lines, 'XtestOverProp', 'D')
29607
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1275 let buf = RunVimInTerminal('-S XtestOverProp', {'rows': 8})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1276 call VerifyScreenDump(buf, 'Test_textprop_hl_override_1', {})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1277
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1278 call term_sendkeys(buf, "3Gllv$hh")
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1279 call VerifyScreenDump(buf, 'Test_textprop_hl_override_2', {})
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1280 call term_sendkeys(buf, "\<Esc>")
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1281
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1282 " clean up
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1283 call StopVimInTerminal(buf)
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1284 endfunc
33d7c1fa2dac patch 9.0.0144: text property cannot override 'cursorline' highlight
Bram Moolenaar <Bram@vim.org>
parents: 29605
diff changeset
1285
16682
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1286 func RunTestVisualBlock(width, dump)
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1287 call writefile([
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1288 \ "call setline(1, ["
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1289 \ .. "'xxxxxxxxx 123 x',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1290 \ .. "'xxxxxxxx 123 x',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1291 \ .. "'xxxxxxx 123 x',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1292 \ .. "'xxxxxx 123 x',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1293 \ .. "'xxxxx 123 x',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1294 \ .. "'xxxx 123 xx',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1295 \ .. "'xxx 123 xxx',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1296 \ .. "'xx 123 xxxx',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1297 \ .. "'x 123 xxxxx',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1298 \ .. "' 123 xxxxxx',"
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1299 \ .. "])",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1300 \ "hi SearchProp ctermbg=yellow",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1301 \ "call prop_type_add('search', {'highlight': 'SearchProp'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1302 \ "call prop_add(1, 11, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1303 \ "call prop_add(2, 10, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1304 \ "call prop_add(3, 9, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1305 \ "call prop_add(4, 8, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1306 \ "call prop_add(5, 7, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1307 \ "call prop_add(6, 6, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1308 \ "call prop_add(7, 5, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1309 \ "call prop_add(8, 4, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1310 \ "call prop_add(9, 3, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1311 \ "call prop_add(10, 2, {'length': 3, 'type': 'search'})",
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1312 \ "normal 1G6|\<C-V>" .. repeat('l', a:width - 1) .. "10jx",
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
1313 \], 'XtestPropVis', 'D')
16682
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1314 let buf = RunVimInTerminal('-S XtestPropVis', {'rows': 12})
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1315 call VerifyScreenDump(buf, 'Test_textprop_vis_' .. a:dump, {})
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1316
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1317 " clean up
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1318 call StopVimInTerminal(buf)
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1319 endfunc
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1320
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1321 " screenshot test with Visual block mode operations
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1322 func Test_textprop_screenshot_visual()
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1323 CheckScreendump
16682
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1324
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1325 " Delete two columns while text props are three chars wide.
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1326 call RunTestVisualBlock(2, '01')
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1327
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1328 " Same, but delete four columns
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1329 call RunTestVisualBlock(4, '02')
7847d281cbbf patch 8.1.1343: text properties not adjusted for Visual block mode delete
Bram Moolenaar <Bram@vim.org>
parents: 16678
diff changeset
1330 endfunc
16770
09c81f17f83c patch 8.1.1387: calling prop_add() in an empty buffer doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 16714
diff changeset
1331
17143
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1332 func Test_textprop_after_tab()
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1333 CheckScreendump
17147
a001a0d88d42 patch 8.1.1573: textprop test fails if screenhots do not work
Bram Moolenaar <Bram@vim.org>
parents: 17143
diff changeset
1334
17143
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1335 let lines =<< trim END
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1336 call setline(1, [
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1337 \ "\txxx",
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1338 \ "x\txxx",
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1339 \ ])
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1340 hi SearchProp ctermbg=yellow
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1341 call prop_type_add('search', {'highlight': 'SearchProp'})
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1342 call prop_add(1, 2, {'length': 3, 'type': 'search'})
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1343 call prop_add(2, 3, {'length': 3, 'type': 'search'})
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1344 END
31788
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1345 call writefile(lines, 'XtextPropTab', 'D')
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1346 let buf = RunVimInTerminal('-S XtextPropTab', {'rows': 6})
17143
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1347 call VerifyScreenDump(buf, 'Test_textprop_tab', {})
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1348
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1349 " clean up
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1350 call StopVimInTerminal(buf)
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1351 endfunc
ee090ecd70f6 patch 8.1.1571: textprop highlight starts too early if just after a tab
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1352
31788
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1353 func Test_textprop_nesting()
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1354 CheckScreendump
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1355
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1356 let lines =<< trim END
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1357 vim9script
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1358 var lines =<< trim LINESEND
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1359
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1360 const func: func.IFunction = ({
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1361 setLoading
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1362 }) => {
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1363 LINESEND
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1364 setline(1, lines)
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1365 prop_type_add('prop_add_test', {highlight: "ErrorMsg"})
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1366 prop_add(2, 31, {type: 'prop_add_test', end_lnum: 4, end_col: 2})
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1367 var text = 'text long enough to wrap line, text long enough to wrap line, text long enough to wrap line...'
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1368 prop_add(2, 0, {type: 'prop_add_test', text_wrap: 'truncate', text_align: 'after', text: text})
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1369 END
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1370 call writefile(lines, 'XtextpropNesting', 'D')
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1371 let buf = RunVimInTerminal('-S XtextpropNesting', {'rows': 8})
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1372 call VerifyScreenDump(buf, 'Test_textprop_nesting', {})
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1373
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1374 " clean up
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1375 call StopVimInTerminal(buf)
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1376 endfunc
7d0025a2940a patch 9.0.1226: spurious empty line when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 31584
diff changeset
1377
23901
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1378 func Test_textprop_nowrap_scrolled()
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1379 CheckScreendump
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1380
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1381 let lines =<< trim END
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1382 vim9script
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1383 set nowrap
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1384 setline(1, 'The number 123 is smaller than 4567.' .. repeat('X', &columns))
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1385 prop_type_add('number', {'highlight': 'ErrorMsg'})
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1386 prop_add(1, 12, {'length': 3, 'type': 'number'})
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1387 prop_add(1, 32, {'length': 4, 'type': 'number'})
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1388 feedkeys('gg20zl', 'nxt')
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1389 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
1390 call writefile(lines, 'XtestNowrap', 'D')
23901
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1391 let buf = RunVimInTerminal('-S XtestNowrap', {'rows': 6})
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1392 call VerifyScreenDump(buf, 'Test_textprop_nowrap_01', {})
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1393
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1394 call term_sendkeys(buf, "$")
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1395 call VerifyScreenDump(buf, 'Test_textprop_nowrap_02', {})
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1396
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1397 " clean up
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1398 call StopVimInTerminal(buf)
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1399 endfunc
6793853063e5 patch 8.2.2493: text property for text left of window shows up
Bram Moolenaar <Bram@vim.org>
parents: 23776
diff changeset
1400
29690
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1401 func Test_textprop_text_priority()
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1402 CheckScreendump
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1403
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1404 let lines =<< trim END
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1405 call setline(1, "function( call, argument, here )")
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1406
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1407 call prop_type_add('one', #{highlight: 'Error'})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1408 call prop_type_add('two', #{highlight: 'Function'})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1409 call prop_type_add('three', #{highlight: 'DiffChange'})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1410 call prop_type_add('arg', #{highlight: 'Search'})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1411
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1412 call prop_add(1, 27, #{type: 'arg', length: len('here')})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1413 call prop_add(1, 27, #{type: 'three', text: 'three: '})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1414 call prop_add(1, 11, #{type: 'one', text: 'one: '})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1415 call prop_add(1, 11, #{type: 'arg', length: len('call')})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1416 call prop_add(1, 17, #{type: 'two', text: 'two: '})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1417 call prop_add(1, 17, #{type: 'arg', length: len('argument')})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1418 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
1419 call writefile(lines, 'XtestPropPrio', 'D')
29690
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1420 let buf = RunVimInTerminal('-S XtestPropPrio', {'rows': 5})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1421 call VerifyScreenDump(buf, 'Test_prop_at_same_pos', {})
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1422
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1423 " clean up
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1424 call StopVimInTerminal(buf)
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1425 endfunc
1a9b3c96ed08 patch 9.0.0185: virtual text does not show if text prop at same position
Bram Moolenaar <Bram@vim.org>
parents: 29688
diff changeset
1426
33868
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1427 func Test_textprop_in_empty_popup()
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1428 CheckScreendump
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1429
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1430 let lines =<< trim END
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1431 vim9script
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1432
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1433 hi def link FilterMenuMatch Constant
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1434 prop_type_add('FilterMenuMatch', {
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1435 highlight: "FilterMenuMatch",
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1436 override: true,
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1437 priority: 1000,
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1438 combine: true,
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1439 })
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1440
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1441 var winid = popup_create([{text: "hello", props: [
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1442 {col: 1, length: 1, type: 'FilterMenuMatch'},
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1443 {col: 2, length: 1, type: 'FilterMenuMatch'},
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1444 ]}], {
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1445 minwidth: 20,
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1446 minheight: 10,
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1447 cursorline: false,
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1448 highlight: "None",
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1449 border: [],
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1450 })
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1451
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1452 win_execute(winid, "setl nu cursorline cursorlineopt=both")
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1453 popup_settext(winid, [])
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1454 redraw
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1455 END
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1456 call writefile(lines, 'XtestPropEmptyPopup', 'D')
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1457 let buf = RunVimInTerminal('-S XtestPropEmptyPopup', #{rows: 20, cols: 40})
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1458 call VerifyScreenDump(buf, 'Test_prop_in_empty_popup', {})
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1459
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1460 " clean up
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1461 call StopVimInTerminal(buf)
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1462 endfunc
25e5297fbc72 patch 9.0.2144: Text properties causes wrong line wrapping
Christian Brabandt <cb@256bit.org>
parents: 33248
diff changeset
1463
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1464 func Test_textprop_with_syntax()
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1465 CheckScreendump
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1466
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1467 let lines =<< trim END
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1468 call setline(1, [
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1469 \ "(abc)",
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1470 \ ])
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1471 syn match csParens "[()]" display
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1472 hi! link csParens MatchParen
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1473
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1474 call prop_type_add('TPTitle', #{ highlight: 'Title' })
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1475 call prop_add(1, 2, #{type: 'TPTitle', end_col: 5})
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1476 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
1477 call writefile(lines, 'XtestPropSyn', 'D')
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1478 let buf = RunVimInTerminal('-S XtestPropSyn', {'rows': 6})
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1479 call VerifyScreenDump(buf, 'Test_textprop_syn_1', {})
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1480
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1481 " clean up
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1482 call StopVimInTerminal(buf)
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1483 endfunc
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 17980
diff changeset
1484
16770
09c81f17f83c patch 8.1.1387: calling prop_add() in an empty buffer doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 16714
diff changeset
1485 " Adding a text property to a new buffer should not fail
09c81f17f83c patch 8.1.1387: calling prop_add() in an empty buffer doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 16714
diff changeset
1486 func Test_textprop_empty_buffer()
09c81f17f83c patch 8.1.1387: calling prop_add() in an empty buffer doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 16714
diff changeset
1487 call prop_type_add('comment', {'highlight': 'Search'})
09c81f17f83c patch 8.1.1387: calling prop_add() in an empty buffer doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 16714
diff changeset
1488 new
09c81f17f83c patch 8.1.1387: calling prop_add() in an empty buffer doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 16714
diff changeset
1489 call prop_add(1, 1, {'type': 'comment'})
09c81f17f83c patch 8.1.1387: calling prop_add() in an empty buffer doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 16714
diff changeset
1490 close
16786
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1491 call prop_type_delete('comment')
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1492 endfunc
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1493
17208
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1494 " Adding a text property with invalid highlight should be ignored.
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1495 func Test_textprop_invalid_highlight()
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1496 call assert_fails("call prop_type_add('dni', {'highlight': 'DoesNotExist'})", 'E970:')
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1497 new
29788
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
1498 call setline(1, ['asdf', 'asdf'])
17208
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1499 call prop_add(1, 1, {'length': 4, 'type': 'dni'})
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1500 redraw
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1501 bwipe!
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1502 call prop_type_delete('dni')
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1503 endfunc
13d0753511fe patch 8.1.1603: crash when using unknown highlighting in text property
Bram Moolenaar <Bram@vim.org>
parents: 17147
diff changeset
1504
16786
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1505 " Adding a text property to an empty buffer and then editing another
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1506 func Test_textprop_empty_buffer_next()
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1507 call prop_type_add("xxx", {})
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1508 call prop_add(1, 1, {"type": "xxx"})
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1509 next X
98ca522e6453 patch 8.1.1395: saving for undo may access invalid memory
Bram Moolenaar <Bram@vim.org>
parents: 16772
diff changeset
1510 call prop_type_delete('xxx')
16770
09c81f17f83c patch 8.1.1387: calling prop_add() in an empty buffer doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 16714
diff changeset
1511 endfunc
16772
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1512
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1513 func Test_textprop_remove_from_buf()
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1514 new
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1515 let buf = bufnr('')
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1516 call prop_type_add('one', {'bufnr': buf})
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1517 call prop_add(1, 1, {'type': 'one', 'id': 234})
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1518 file x
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1519 edit y
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1520 call prop_remove({'id': 234, 'bufnr': buf}, 1)
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1521 call prop_type_delete('one', {'bufnr': buf})
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1522 bwipe! x
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1523 close
18093a6accb5 patch 8.1.1388: errors when calling prop_remove() for an unloaded buffer
Bram Moolenaar <Bram@vim.org>
parents: 16770
diff changeset
1524 endfunc
17694
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1525
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1526 func Test_textprop_in_unloaded_buf()
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1527 edit Xaaa
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1528 call setline(1, 'aaa')
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1529 write
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1530 edit Xbbb
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1531 call setline(1, 'bbb')
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1532 write
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1533 let bnr = bufnr('')
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1534 edit Xaaa
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1535
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1536 call prop_type_add('ErrorMsg', #{highlight:'ErrorMsg'})
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1537 call assert_fails("call prop_add(1, 1, #{end_lnum: 1, endcol: 2, type: 'ErrorMsg', bufnr: bnr})", 'E275:')
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1538 exe 'buf ' .. bnr
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1539 call assert_equal('bbb', getline(1))
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1540 call assert_equal(0, prop_list(1)->len())
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1541
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1542 bwipe! Xaaa
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1543 bwipe! Xbbb
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1544 cal delete('Xaaa')
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1545 cal delete('Xbbb')
6f9cde96ee3c patch 8.1.1844: buffer no longer unloaded when adding text properties
Bram Moolenaar <Bram@vim.org>
parents: 17208
diff changeset
1546 endfunc
18444
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1547
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1548 func Test_proptype_substitute2()
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1549 new
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1550 " text_prop.vim
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1551 call setline(1, [
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1552 \ 'The num 123 is smaller than 4567.',
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1553 \ '123 The number 123 is smaller than 4567.',
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1554 \ '123 The number 123 is smaller than 4567.'])
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1555
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1556 call prop_type_add('number', {'highlight': 'ErrorMsg'})
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1557
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1558 call prop_add(1, 12, {'length': 3, 'type': 'number'})
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1559 call prop_add(2, 1, {'length': 3, 'type': 'number'})
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1560 call prop_add(3, 36, {'length': 4, 'type': 'number'})
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1561 set ul&
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1562 let expected = [
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1563 \ #{type_bufnr: 0, id: 0, col: 13, end: 1, type: 'number', length: 3, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1564 \ #{type_bufnr: 0, id: 0, col: 1, end: 1, type: 'number', length: 3, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1565 \ #{type_bufnr: 0, id: 0, col: 50, end: 1, type: 'number', length: 4, start: 1}]
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1566
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1567 " TODO
29609
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1568 if 0
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1569 " Add some text in between
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1570 %s/\s\+/ /g
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1571 call assert_equal(expected, prop_list(1) + prop_list(2) + prop_list(3))
18444
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1572
29609
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1573 " remove some text
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1574 :1s/[a-z]\{3\}//g
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1575 let expected = [{'id': 0, 'col': 10, 'end': 1, 'type': 'number', 'length': 3, 'start': 1}]
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1576 call assert_equal(expected, prop_list(1))
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1577 endif
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1578
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1579 call prop_type_delete('number')
18444
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1580 bwipe!
967ca19425e3 patch 8.1.2216: text property in wrong place after :substitute
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
1581 endfunc
19045
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1582
22331
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1583 " This was causing property corruption.
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1584 func Test_proptype_substitute3()
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1585 new
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1586 call setline(1, ['abcxxx', 'def'])
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1587 call prop_type_add("test", {"highlight": "Search"})
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1588 call prop_add(1, 2, {"end_lnum": 2, "end_col": 2, "type": "test"})
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1589 %s/x\+$//
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1590 redraw
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1591
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1592 call prop_type_delete('test')
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1593 bwipe!
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1594 endfunc
0271c2b8bb35 patch 8.2.1714: text properties corrupted with substitute command
Bram Moolenaar <Bram@vim.org>
parents: 22282
diff changeset
1595
29609
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1596 func Test_proptype_substitute_join()
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1597 new
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1598 call setline(1, [
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1599 \ 'This is some end',
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1600 \ 'start is highlighted end',
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1601 \ 'some is highlighted',
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1602 \ 'start is also highlighted'])
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1603
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1604 call prop_type_add('number', {'highlight': 'ErrorMsg'})
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1605
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1606 call prop_add(1, 6, {'length': 2, 'type': 'number'})
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1607 call prop_add(2, 7, {'length': 2, 'type': 'number'})
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1608 call prop_add(3, 6, {'length': 2, 'type': 'number'})
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1609 call prop_add(4, 7, {'length': 2, 'type': 'number'})
32244
533e36e02a68 patch 9.0.1453: typos in source code and tests
Bram Moolenaar <Bram@vim.org>
parents: 31990
diff changeset
1610 " The highlighted "is" in line 1, 2 and 4 is kept and adjusted.
29609
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1611 " The highlighted "is" in line 3 is deleted.
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1612 let expected = [
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1613 \ #{type_bufnr: 0, id: 0, col: 6, end: 1, type: 'number', length: 2, start: 1},
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1614 \ #{type_bufnr: 0, id: 0, col: 21, end: 1, type: 'number', length: 2, start: 1},
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1615 \ #{type_bufnr: 0, id: 0, col: 43, end: 1, type: 'number', length: 2, start: 1}]
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1616
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1617 s/end\nstart/joined/
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1618 s/end\n.*\nstart/joined/
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1619 call assert_equal('This is some joined is highlighted joined is also highlighted', getline(1))
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1620 call assert_equal(expected, prop_list(1))
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1621
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1622 call prop_type_delete('number')
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1623 bwipe!
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1624 endfunc
e1c370197030 patch 9.0.0145: substitute that joins lines drops text properties
Bram Moolenaar <Bram@vim.org>
parents: 29607
diff changeset
1625
19097
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1626 func SaveOptions()
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1627 let d = #{tabstop: &tabstop,
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1628 \ softtabstop: &softtabstop,
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1629 \ shiftwidth: &shiftwidth,
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1630 \ expandtab: &expandtab,
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1631 \ foldmethod: '"' .. &foldmethod .. '"',
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1632 \ }
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1633 return d
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1634 endfunc
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1635
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1636 func RestoreOptions(dict)
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1637 for name in keys(a:dict)
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1638 exe 'let &' .. name .. ' = ' .. a:dict[name]
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1639 endfor
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1640 endfunc
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1641
19045
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1642 func Test_textprop_noexpandtab()
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1643 new
19097
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1644 let save_dict = SaveOptions()
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1645
19045
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1646 set tabstop=8
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1647 set softtabstop=4
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1648 set shiftwidth=4
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1649 set noexpandtab
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1650 set foldmethod=marker
19097
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1651
19045
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1652 call feedkeys("\<esc>\<esc>0Ca\<cr>\<esc>\<up>", "tx")
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1653 call prop_type_add('test', {'highlight': 'ErrorMsg'})
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1654 call prop_add(1, 1, {'end_col': 2, 'type': 'test'})
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1655 call feedkeys("0i\<tab>", "tx")
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1656 call prop_remove({'type': 'test'})
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1657 call prop_add(1, 2, {'end_col': 3, 'type': 'test'})
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1658 call feedkeys("A\<left>\<tab>", "tx")
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1659 call prop_remove({'type': 'test'})
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1660 try
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1661 " It is correct that this does not pass
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1662 call prop_add(1, 6, {'end_col': 7, 'type': 'test'})
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1663 " Has already collapsed here, start_col:6 does not result in an error
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1664 call feedkeys("A\<left>\<tab>", "tx")
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1665 catch /^Vim\%((\a\+)\)\=:E964/
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1666 endtry
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1667 call prop_remove({'type': 'test'})
19097
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1668 call prop_type_delete('test')
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1669
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1670 call RestoreOptions(save_dict)
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1671 bwipe!
19045
143d44d8f477 patch 8.2.0083: text properties wrong when tabs and spaces are exchanged
Bram Moolenaar <Bram@vim.org>
parents: 18631
diff changeset
1672 endfunc
19097
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1673
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1674 func Test_textprop_noexpandtab_redraw()
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1675 new
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1676 let save_dict = SaveOptions()
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1677
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1678 set tabstop=8
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1679 set softtabstop=4
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1680 set shiftwidth=4
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1681 set noexpandtab
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1682 set foldmethod=marker
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1683
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1684 call feedkeys("\<esc>\<esc>0Ca\<cr>\<space>\<esc>\<up>", "tx")
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1685 call prop_type_add('test', {'highlight': 'ErrorMsg'})
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1686 call prop_add(1, 1, {'end_col': 2, 'type': 'test'})
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1687 call feedkeys("0i\<tab>", "tx")
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1688 " Internally broken at the next line
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1689 call feedkeys("A\<left>\<tab>", "tx")
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1690 redraw
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1691 " Index calculation failed internally on next line
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1692 call prop_add(1, 1, {'end_col': 2, 'type': 'test'})
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1693 call prop_remove({'type': 'test', 'all': v:true})
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1694 call prop_type_delete('test')
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1695 call prop_type_delete('test')
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1696
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1697 call RestoreOptions(save_dict)
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1698 bwipe!
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1699 endfunc
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1700
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1701 func Test_textprop_ins_str()
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1702 new
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1703 call setline(1, 'just some text')
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1704 call prop_type_add('test', {'highlight': 'ErrorMsg'})
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1705 call prop_add(1, 1, {'end_col': 2, 'type': 'test'})
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1706 call assert_equal([#{type_bufnr: 0, id: 0, col: 1, end: 1, type: 'test', length: 1, start: 1}], prop_list(1))
19097
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1707
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1708 call feedkeys("foi\<F8>\<Esc>", "tx")
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1709 call assert_equal('just s<F8>ome text', getline(1))
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1710 call assert_equal([#{type_bufnr: 0, id: 0, col: 1, end: 1, type: 'test', length: 1, start: 1}], prop_list(1))
19097
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1711
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1712 bwipe!
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1713 call prop_remove({'type': 'test'})
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1714 call prop_type_delete('test')
bcbc9fe665b5 patch 8.2.0109: corrupted text properties when expanding spaces
Bram Moolenaar <Bram@vim.org>
parents: 19045
diff changeset
1715 endfunc
19631
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1716
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1717 func Test_find_prop_later_in_line()
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1718 new
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1719 call prop_type_add('test', {'highlight': 'ErrorMsg'})
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1720 call setline(1, 'just some text')
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1721 call prop_add(1, 1, {'length': 4, 'type': 'test'})
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1722 call prop_add(1, 10, {'length': 3, 'type': 'test'})
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1723
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1724 call assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1725 \ #{type_bufnr: 0, id: 0, lnum: 1, col: 10, end: 1, type: 'test', length: 3, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1726 \ prop_find(#{type: 'test', lnum: 1, col: 6}))
19631
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1727
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1728 bwipe!
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1729 call prop_type_delete('test')
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1730 endfunc
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1731
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1732 func Test_find_zerowidth_prop_sol()
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1733 new
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1734 call prop_type_add('test', {'highlight': 'ErrorMsg'})
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1735 call setline(1, 'just some text')
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1736 call prop_add(1, 1, {'length': 0, 'type': 'test'})
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1737
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1738 call assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1739 \ #{type_bufnr: 0, id: 0, lnum: 1, col: 1, end: 1, type: 'test', length: 0, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1740 \ prop_find(#{type: 'test', lnum: 1}))
19631
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1741
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1742 bwipe!
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1743 call prop_type_delete('test')
1d493fce1fbd patch 8.2.0372: prop_find() may not find text property at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 19601
diff changeset
1744 endfunc
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1745
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1746 " Test for passing invalid arguments to prop_xxx() functions
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1747 func Test_prop_func_invalid_args()
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1748 call assert_fails('call prop_clear(1, 2, [])', 'E715:')
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1749 call assert_fails('call prop_clear(-1, 2)', 'E16:')
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 29918
diff changeset
1750 call assert_fails('call prop_find(test_null_dict())', 'E1297:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20583
diff changeset
1751 call assert_fails('call prop_find({"bufnr" : []})', 'E730:')
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1752 call assert_fails('call prop_find({})', 'E968:')
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1753 call assert_fails('call prop_find({}, "x")', 'E474:')
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1754 call assert_fails('call prop_find({"lnum" : -2})', 'E16:')
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 29918
diff changeset
1755 call assert_fails('call prop_list(1, [])', 'E1206:')
21552
cbc570e66d11 patch 8.2.1326: Vim9: skipping over white space after list
Bram Moolenaar <Bram@vim.org>
parents: 21265
diff changeset
1756 call assert_fails('call prop_list(-1, {})', 'E16:')
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 29918
diff changeset
1757 call assert_fails('call prop_remove([])', 'E1206:')
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1758 call assert_fails('call prop_remove({}, -2)', 'E16:')
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1759 call assert_fails('call prop_remove({})', 'E968:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20583
diff changeset
1760 call assert_fails('call prop_type_add([], {})', 'E730:')
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1761 call assert_fails("call prop_type_change('long', {'xyz' : 10})", 'E971:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20583
diff changeset
1762 call assert_fails("call prop_type_delete([])", 'E730:')
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1763 call assert_fails("call prop_type_delete('xyz', [])", 'E715:')
21265
6a4806e326dd patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents: 20583
diff changeset
1764 call assert_fails("call prop_type_get([])", 'E730:')
31319
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
1765 call assert_fails("call prop_type_get('', [])", 'E475:')
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1766 call assert_fails("call prop_type_list([])", 'E715:')
24039
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1767 call assert_fails("call prop_type_add('yyy', 'not_a_dict')", 'E715:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1768 call assert_fails("call prop_add(1, 5, {'type':'missing_type', 'length':1})", 'E971:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1769 call assert_fails("call prop_add(1, 5, {'type': ''})", 'E971:')
29994
86eb4aba16c3 patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents: 29918
diff changeset
1770 call assert_fails('call prop_add(1, 1, 0)', 'E1206:')
24039
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1771
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1772 new
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1773 call setline(1, ['first', 'second'])
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1774 call prop_type_add('xxx', {})
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1775
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1776 call assert_fails("call prop_type_add('xxx', {})", 'E969:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1777 call assert_fails("call prop_add(2, 0, {'type': 'xxx'})", 'E964:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1778 call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'end_lnum':1})", 'E475:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1779 call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'end_lnum':3})", 'E966:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1780 call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'length':-1})", 'E475:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1781 call assert_fails("call prop_add(2, 3, {'type': 'xxx', 'end_col':0})", 'E475:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1782 call assert_fails("call prop_add(2, 3, {'length':1})", 'E965:')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1783
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1784 call prop_type_delete('xxx')
a5478836fcb7 patch 8.2.2561: not all textprop code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 23901
diff changeset
1785 bwipe!
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1786 endfunc
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
1787
22278
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1788 func Test_prop_split_join()
20583
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1789 new
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1790 call prop_type_add('test', {'highlight': 'ErrorMsg'})
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1791 call setline(1, 'just some text')
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1792 call prop_add(1, 6, {'length': 4, 'type': 'test'})
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1793
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1794 " Split in middle of "some"
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1795 execute "normal! 8|i\<CR>"
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1796 call assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1797 \ [#{type_bufnr: 0, id: 0, col: 6, end: 0, type: 'test', length: 2, start: 1}],
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1798 \ prop_list(1))
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1799 call assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1800 \ [#{type_bufnr: 0, id: 0, col: 1, end: 1, type: 'test', length: 2, start: 0}],
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1801 \ prop_list(2))
20583
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1802
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1803 " Join the two lines back together
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1804 normal! 1GJ
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1805 call assert_equal([#{type_bufnr: 0, id: 0, col: 6, end: 1, type: 'test', length: 5, start: 1}], prop_list(1))
20583
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1806
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1807 bwipe!
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1808 call prop_type_delete('test')
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1809 endfunc
d067be761cd7 patch 8.2.0845: text properties crossing lines not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 20178
diff changeset
1810
22278
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1811 func Test_prop_increment_decrement()
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1812 new
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1813 call prop_type_add('test', {'highlight': 'ErrorMsg'})
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1814 call setline(1, 'its 998 times')
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1815 call prop_add(1, 5, {'length': 3, 'type': 'test'})
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1816
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1817 exe "normal! 0f9\<C-A>"
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1818 eval getline(1)->assert_equal('its 999 times')
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1819 eval prop_list(1)->assert_equal([
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1820 \ #{type_bufnr: 0, id: 0, col: 5, end: 1, type: 'test', length: 3, start: 1}])
22278
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1821
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1822 exe "normal! 0f9\<C-A>"
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1823 eval getline(1)->assert_equal('its 1000 times')
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1824 eval prop_list(1)->assert_equal([
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1825 \ #{type_bufnr: 0, id: 0, col: 5, end: 1, type: 'test', length: 4, start: 1}])
22278
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1826
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1827 bwipe!
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1828 call prop_type_delete('test')
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1829 endfunc
0416105e103b patch 8.2.1688: increment/decrement removes text property
Bram Moolenaar <Bram@vim.org>
parents: 22147
diff changeset
1830
22282
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1831 func Test_prop_block_insert()
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1832 new
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1833 call prop_type_add('test', {'highlight': 'ErrorMsg'})
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1834 call setline(1, ['one ', 'two '])
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1835 call prop_add(1, 1, {'length': 3, 'type': 'test'})
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1836 call prop_add(2, 1, {'length': 3, 'type': 'test'})
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1837
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1838 " insert "xx" in the first column of both lines
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1839 exe "normal! gg0\<C-V>jIxx\<Esc>"
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1840 eval getline(1, 2)->assert_equal(['xxone ', 'xxtwo '])
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
1841 let expected = [#{type_bufnr: 0, id: 0, col: 3, end: 1, type: 'test', length: 3, start: 1}]
22282
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1842 eval prop_list(1)->assert_equal(expected)
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1843 eval prop_list(2)->assert_equal(expected)
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1844
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1845 " insert "yy" inside the text props to make them longer
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1846 exe "normal! gg03l\<C-V>jIyy\<Esc>"
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1847 eval getline(1, 2)->assert_equal(['xxoyyne ', 'xxtyywo '])
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1848 let expected[0].length = 5
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1849 eval prop_list(1)->assert_equal(expected)
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1850 eval prop_list(2)->assert_equal(expected)
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1851
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1852 " insert "zz" after the text props, text props don't change
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1853 exe "normal! gg07l\<C-V>jIzz\<Esc>"
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1854 eval getline(1, 2)->assert_equal(['xxoyynezz ', 'xxtyywozz '])
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1855 eval prop_list(1)->assert_equal(expected)
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1856 eval prop_list(2)->assert_equal(expected)
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1857
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1858 bwipe!
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1859 call prop_type_delete('test')
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1860 endfunc
5adb97bf0b32 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 22278
diff changeset
1861
23306
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1862 " this was causing an ml_get error because w_botline was wrong
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1863 func Test_prop_one_line_window()
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1864 enew
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1865 call range(2)->setline(1)
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1866 call prop_type_add('testprop', {})
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1867 call prop_add(1, 1, {'type': 'testprop'})
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1868 call popup_create('popup', {'textprop': 'testprop'})
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1869 $
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1870 new
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1871 wincmd _
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1872 call feedkeys("\r", 'xt')
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1873 redraw
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1874
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1875 call popup_clear()
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1876 call prop_type_delete('testprop')
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1877 close
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1878 bwipe!
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1879 endfunc
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
1880
29587
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1881 def Test_prop_column_zero_error()
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1882 prop_type_add('proptype', {highlight: 'Search'})
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1883 var caught = false
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1884 try
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1885 popup_create([{
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1886 text: 'a',
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1887 props: [{col: 0, length: 1, type: 'type'}],
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1888 }], {})
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1889 catch /E964:/
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1890 caught = true
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1891 endtry
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1892 assert_true(caught)
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1893
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1894 popup_clear()
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1895 prop_type_delete('proptype')
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1896 enddef
d70f588baaa1 patch 9.0.0134: no test for text property with column zero
Bram Moolenaar <Bram@vim.org>
parents: 29585
diff changeset
1897
24703
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1898 " This was calling ml_append_int() and copy a text property from a previous
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1899 " line at the wrong moment. Exact text length matters.
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1900 def Test_prop_splits_data_block()
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1901 new
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1902 var lines: list<string> = [repeat('x', 35)]->repeat(41)
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1903 + [repeat('!', 35)]
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1904 + [repeat('x', 35)]->repeat(56)
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1905 lines->setline(1)
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1906 prop_type_add('someprop', {highlight: 'ErrorMsg'})
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1907 prop_add(1, 27, {end_lnum: 1, end_col: 70, type: 'someprop'})
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1908 prop_remove({type: 'someprop'}, 1)
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1909 prop_add(35, 22, {end_lnum: 43, end_col: 43, type: 'someprop'})
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1910 prop_remove({type: 'someprop'}, 35, 43)
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1911 assert_equal([], prop_list(42))
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1912
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1913 bwipe!
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1914 prop_type_delete('someprop')
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1915 enddef
4bc0bda6857d patch 8.2.2890: text property duplicated when data block splits
Bram Moolenaar <Bram@vim.org>
parents: 24252
diff changeset
1916
25050
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1917 " This was calling ml_delete_int() and try to change text properties.
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1918 def Test_prop_add_delete_line()
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1919 new
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1920 var a = 10
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1921 var b = 20
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1922 repeat([''], a)->append('$')
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1923 prop_type_add('Test', {highlight: 'ErrorMsg'})
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1924 for lnum in range(1, a)
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1925 for col in range(1, b)
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1926 prop_add(1, 1, {end_lnum: lnum, end_col: col, type: 'Test'})
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1927 endfor
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1928 endfor
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1929
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1930 # check deleting lines is OK
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1931 :5del
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1932 :1del
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1933 :$del
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1934
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1935 prop_type_delete('Test')
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1936 bwipe!
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1937 enddef
7ef7a211f6bf patch 8.2.3062: internal error when adding several text properties
Bram Moolenaar <Bram@vim.org>
parents: 24703
diff changeset
1938
28875
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1939 " This test is to detect a regression related to #10430. It is not an attempt
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1940 " fully cover deleting lines in the presence of multi-line properties.
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1941 def Test_delete_line_within_multiline_prop()
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1942 new
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1943 setline(1, '# Top.')
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1944 append(1, ['some_text = """', 'A string.', '"""', '# Bottom.'])
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1945 prop_type_add('Identifier', {'highlight': 'ModeMsg', 'priority': 0, 'combine': 0, 'start_incl': 0, 'end_incl': 0})
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1946 prop_type_add('String', {'highlight': 'MoreMsg', 'priority': 0, 'combine': 0, 'start_incl': 0, 'end_incl': 0})
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1947 prop_add(2, 1, {'type': 'Identifier', 'end_lnum': 2, 'end_col': 9})
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1948 prop_add(2, 13, {'type': 'String', 'end_lnum': 4, 'end_col': 4})
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1949
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1950 # The property for line 3 should extend into the previous and next lines.
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1951 var props = prop_list(3)
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1952 var prop = props[0]
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1953 assert_equal(1, len(props))
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1954 assert_equal(0, prop['start'])
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1955 assert_equal(0, prop['end'])
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1956
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1957 # This deletion should run without raising an exception.
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1958 try
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1959 :2 del
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1960 catch
30986
360f286b5869 patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents: 30900
diff changeset
1961 assert_report('Line delete should have worked, but it raised an error.')
28875
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1962 endtry
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1963
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1964 # The property for line 2 (was 3) should no longer extend into the previous
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1965 # line.
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1966 props = prop_list(2)
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1967 prop = props[0]
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1968 assert_equal(1, len(props))
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1969 assert_equal(1, prop['start'], 'Property was not changed to start within the line.')
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1970
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1971 # This deletion should run without raising an exception.
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1972 try
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1973 :3 del
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1974 catch
30986
360f286b5869 patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents: 30900
diff changeset
1975 assert_report('Line delete should have worked, but it raised an error.')
28875
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1976 endtry
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1977
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1978 # The property for line 2 (originally 3) should no longer extend into the next
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1979 # line.
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1980 props = prop_list(2)
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1981 prop = props[0]
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1982 assert_equal(1, len(props))
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1983 assert_equal(1, prop['end'], 'Property was not changed to end within the line.')
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1984
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1985 prop_type_delete('Identifier')
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1986 prop_type_delete('String')
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1987 bwip!
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1988 enddef
78ebb50d6fcb patch 8.2.4960: text properties that cross lines not updated for deleted line
Bram Moolenaar <Bram@vim.org>
parents: 28869
diff changeset
1989
26338
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
1990 func Test_prop_in_linebreak()
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
1991 CheckRunVimInTerminal
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
1992
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
1993 let lines =<< trim END
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
1994 set breakindent linebreak breakat+=]
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
1995 call printf('%s]%s', repeat('x', 50), repeat('x', 70))->setline(1)
30039
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
1996 call prop_type_add('test', #{highlight: 'MatchParen'})
26338
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
1997 call prop_add(1, 51, #{length: 1, type: 'test'})
30039
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
1998 func AddMatch()
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
1999 syntax on
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
2000 syntax match xTest /.*/
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
2001 hi link xTest Comment
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
2002 set signcolumn=yes
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
2003 endfunc
26338
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
2004 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2005 call writefile(lines, 'XscriptPropLinebreak', 'D')
26338
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
2006 let buf = RunVimInTerminal('-S XscriptPropLinebreak', #{rows: 10})
30039
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
2007 call VerifyScreenDump(buf, 'Test_prop_linebreak_1', {})
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
2008
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
2009 call term_sendkeys(buf, ":call AddMatch()\<CR>")
4b9b237d1211 patch 9.0.0357: 'linebreak' interferes with text property highlight
Bram Moolenaar <Bram@vim.org>
parents: 30015
diff changeset
2010 call VerifyScreenDump(buf, 'Test_prop_linebreak_2', {})
26338
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
2011
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
2012 call StopVimInTerminal(buf)
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
2013 endfunc
4cf208415483 patch 8.2.3700: text property highlighting continues over breakindent
Bram Moolenaar <Bram@vim.org>
parents: 26242
diff changeset
2014
29686
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2015 func Test_prop_with_linebreak()
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2016 CheckRunVimInTerminal
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2017
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2018 let lines =<< trim END
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2019 vim9script
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2020 set linebreak
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2021 setline(1, 'one twoword')
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2022 prop_type_add('test', {highlight: 'Special'})
33138
22a29cc413c5 patch 9.0.1851: breakindent missing by virt text
Christian Brabandt <cb@256bit.org>
parents: 33103
diff changeset
2023 prop_add(1, 4, {text: ': virtual text', type: 'test'})
29686
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2024 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2025 call writefile(lines, 'XscriptPropWithLinebreak', 'D')
29686
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2026 let buf = RunVimInTerminal('-S XscriptPropWithLinebreak', #{rows: 6, cols: 50})
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2027 call VerifyScreenDump(buf, 'Test_prop_with_linebreak_1', {})
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2028 call term_sendkeys(buf, "iasdf asdf asdf asdf asdf as\<Esc>")
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2029 call VerifyScreenDump(buf, 'Test_prop_with_linebreak_2', {})
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2030
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2031 call StopVimInTerminal(buf)
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2032 endfunc
4153e4815b36 patch 9.0.0183: extra space after virtual text when 'linebreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 29682
diff changeset
2033
29688
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2034 func Test_prop_with_wrap()
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2035 CheckRunVimInTerminal
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2036
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2037 let lines =<< trim END
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2038 vim9script
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2039 set linebreak
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2040 setline(1, 'asdf '->repeat(15))
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2041 prop_type_add('test', {highlight: 'Special'})
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2042 prop_add(1, 43, {text: 'some virtual text', type: 'test'})
31584
cfc60c536a2f patch 9.0.1124: virtual text at a column position is truncated
Bram Moolenaar <Bram@vim.org>
parents: 31489
diff changeset
2043 normal G$
29688
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2044 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2045 call writefile(lines, 'XscriptPropWithWrap', 'D')
29688
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2046 let buf = RunVimInTerminal('-S XscriptPropWithWrap', #{rows: 6, cols: 50})
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2047 call VerifyScreenDump(buf, 'Test_prop_with_wrap_1', {})
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2048
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2049 call StopVimInTerminal(buf)
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2050 endfunc
1455814702ad patch 9.0.0184: virtual text prop highlight continues after truncation
Bram Moolenaar <Bram@vim.org>
parents: 29686
diff changeset
2051
26350
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2052 func Test_prop_after_tab()
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2053 CheckRunVimInTerminal
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2054
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2055 let lines =<< trim END
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2056 set breakindent linebreak breakat+=]
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2057 call setline(1, "\t[xxx]")
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2058 call prop_type_add('test', #{highlight: 'ErrorMsg'})
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2059 call prop_add(1, 2, #{length: 1, type: 'test'})
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2060 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2061 call writefile(lines, 'XscriptPropAfterTab', 'D')
26350
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2062 let buf = RunVimInTerminal('-S XscriptPropAfterTab', #{rows: 10})
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2063 call VerifyScreenDump(buf, 'Test_prop_after_tab', {})
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2064
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2065 call StopVimInTerminal(buf)
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2066 endfunc
13cce5c82c9a patch 8.2.3706: text property highlighting is used on Tab
Bram Moolenaar <Bram@vim.org>
parents: 26338
diff changeset
2067
29676
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2068 func Test_prop_before_tab()
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2069 CheckRunVimInTerminal
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2070
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2071 let lines =<< trim END
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2072 call setline(1, ["\tx"]->repeat(6))
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2073 call prop_type_add('test', #{highlight: 'Search'})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2074 call prop_add(1, 1, #{type: 'test', text: '123'})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2075 call prop_add(2, 1, #{type: 'test', text: '1234567'})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2076 call prop_add(3, 1, #{type: 'test', text: '12345678'})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2077 call prop_add(4, 1, #{type: 'test', text: '123456789'})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2078 call prop_add(5, 2, #{type: 'test', text: 'ABC'})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2079 call prop_add(6, 3, #{type: 'test', text: 'ABC'})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2080 normal gg0
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2081 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2082 call writefile(lines, 'XscriptPropBeforeTab', 'D')
29676
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2083 let buf = RunVimInTerminal('-S XscriptPropBeforeTab', #{rows: 8})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2084 call VerifyScreenDump(buf, 'Test_prop_before_tab_01', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2085 call term_sendkeys(buf, "$")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2086 call VerifyScreenDump(buf, 'Test_prop_before_tab_02', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2087 call term_sendkeys(buf, "j0")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2088 call VerifyScreenDump(buf, 'Test_prop_before_tab_03', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2089 call term_sendkeys(buf, "$")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2090 call VerifyScreenDump(buf, 'Test_prop_before_tab_04', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2091 call term_sendkeys(buf, "j0")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2092 call VerifyScreenDump(buf, 'Test_prop_before_tab_05', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2093 call term_sendkeys(buf, "$")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2094 call VerifyScreenDump(buf, 'Test_prop_before_tab_06', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2095 call term_sendkeys(buf, "j0")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2096 call VerifyScreenDump(buf, 'Test_prop_before_tab_07', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2097 call term_sendkeys(buf, "$")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2098 call VerifyScreenDump(buf, 'Test_prop_before_tab_08', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2099 call term_sendkeys(buf, "j")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2100 call VerifyScreenDump(buf, 'Test_prop_before_tab_09', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2101 call term_sendkeys(buf, "j")
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2102 call VerifyScreenDump(buf, 'Test_prop_before_tab_10', {})
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2103
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2104 call StopVimInTerminal(buf)
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2105 endfunc
b4fea827c20a patch 9.0.0178: cursor position wrong with virtual text before Tab
Bram Moolenaar <Bram@vim.org>
parents: 29666
diff changeset
2106
26384
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2107 func Test_prop_after_linebreak()
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2108 CheckRunVimInTerminal
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2109
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2110 let lines =<< trim END
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2111 set linebreak wrap
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2112 call printf('%s+(%s)', 'x'->repeat(&columns / 2), 'x'->repeat(&columns / 2))->setline(1)
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2113 call prop_type_add('test', #{highlight: 'ErrorMsg'})
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2114 call prop_add(1, (&columns / 2) + 2, #{length: 1, type: 'test'})
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2115 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2116 call writefile(lines, 'XscriptPropAfterLinebreak', 'D')
26384
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2117 let buf = RunVimInTerminal('-S XscriptPropAfterLinebreak', #{rows: 10})
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2118 call VerifyScreenDump(buf, 'Test_prop_after_linebreak', {})
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2119
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2120 call StopVimInTerminal(buf)
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2121 endfunc
e624b4ddbdf0 patch 8.2.3723: when using 'linebreak' a text property starts too early
Bram Moolenaar <Bram@vim.org>
parents: 26350
diff changeset
2122
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2123 " Buffer number of 0 should be ignored, as if the parameter wasn't passed.
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2124 def Test_prop_bufnr_zero()
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2125 new
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2126 try
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2127 var bufnr = bufnr('')
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2128 setline(1, 'hello')
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2129 prop_type_add('bufnr-global', {highlight: 'ErrorMsg'})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2130 prop_type_add('bufnr-buffer', {highlight: 'StatusLine', bufnr: bufnr})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2131
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2132 prop_add(1, 1, {type: 'bufnr-global', length: 1})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2133 prop_add(1, 2, {type: 'bufnr-buffer', length: 1})
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2134
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2135 var list = prop_list(1)
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2136 assert_equal([
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2137 {id: 0, col: 1, type_bufnr: 0, end: 1, type: 'bufnr-global', length: 1, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2138 {id: 0, col: 2, type_bufnr: bufnr, end: 1, type: 'bufnr-buffer', length: 1, start: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2139 ], list)
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2140
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2141 assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2142 {highlight: 'ErrorMsg', end_incl: 0, start_incl: 0, priority: 0, combine: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2143 prop_type_get('bufnr-global', {bufnr: list[0].type_bufnr}))
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2144
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2145 assert_equal(
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2146 {highlight: 'StatusLine', end_incl: 0, start_incl: 0, priority: 0, bufnr: bufnr, combine: 1},
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2147 prop_type_get('bufnr-buffer', {bufnr: list[1].type_bufnr}))
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2148 finally
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2149 bwipe!
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2150 prop_type_delete('bufnr-global')
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2151 endtry
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2152 enddef
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2153
26242
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2154 " Tests for the prop_list() function
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2155 func Test_prop_list()
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2156 let lines =<< trim END
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2157 new
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26384
diff changeset
2158 call g:AddPropTypes()
26242
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2159 call setline(1, repeat([repeat('a', 60)], 10))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2160 call prop_add(1, 4, {'type': 'one', 'id': 5, 'end_col': 6})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2161 call prop_add(1, 5, {'type': 'two', 'id': 10, 'end_col': 7})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2162 call prop_add(3, 12, {'type': 'one', 'id': 20, 'end_col': 14})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2163 call prop_add(3, 13, {'type': 'two', 'id': 10, 'end_col': 15})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2164 call prop_add(5, 20, {'type': 'one', 'id': 10, 'end_col': 22})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2165 call prop_add(5, 21, {'type': 'two', 'id': 20, 'end_col': 23})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2166 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2167 \ {'id': 5, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2168 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2169 \ {'id': 10, 'col': 5, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2170 \ 'type': 'two', 'length': 2, 'start': 1}], prop_list(1))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2171 #" text properties between a few lines
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2172 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2173 \ {'lnum': 3, 'id': 20, 'col': 12, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2174 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2175 \ {'lnum': 3, 'id': 10, 'col': 13, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2176 \ 'type': 'two', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2177 \ {'lnum': 5, 'id': 10, 'col': 20, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2178 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2179 \ {'lnum': 5, 'id': 20, 'col': 21, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2180 \ 'type': 'two', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2181 \ prop_list(2, {'end_lnum': 5}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2182 #" text properties across all the lines
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2183 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2184 \ {'lnum': 1, 'id': 5, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2185 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2186 \ {'lnum': 3, 'id': 20, 'col': 12, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2187 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2188 \ {'lnum': 5, 'id': 10, 'col': 20, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2189 \ 'type': 'one', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2190 \ prop_list(1, {'types': ['one'], 'end_lnum': -1}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2191 #" text properties with the specified identifier
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2192 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2193 \ {'lnum': 3, 'id': 20, 'col': 12, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2194 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2195 \ {'lnum': 5, 'id': 20, 'col': 21, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2196 \ 'type': 'two', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2197 \ prop_list(1, {'ids': [20], 'end_lnum': 10}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2198 #" text properties of the specified type and id
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2199 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2200 \ {'lnum': 1, 'id': 10, 'col': 5, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2201 \ 'type': 'two', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2202 \ {'lnum': 3, 'id': 10, 'col': 13, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2203 \ 'type': 'two', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2204 \ prop_list(1, {'types': ['two'], 'ids': [10], 'end_lnum': 20}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2205 call assert_equal([], prop_list(1, {'ids': [40, 50], 'end_lnum': 10}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2206 call assert_equal([], prop_list(6, {'end_lnum': 10}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2207 call assert_equal([], prop_list(2, {'end_lnum': 2}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2208 #" error cases
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2209 call assert_fails("echo prop_list(1, {'end_lnum': -20})", 'E16:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2210 call assert_fails("echo prop_list(4, {'end_lnum': 2})", 'E16:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2211 call assert_fails("echo prop_list(1, {'end_lnum': '$'})", 'E889:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2212 call assert_fails("echo prop_list(1, {'types': ['blue'], 'end_lnum': 10})",
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2213 \ 'E971:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2214 call assert_fails("echo prop_list(1, {'types': ['one', 'blue'],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2215 \ 'end_lnum': 10})", 'E971:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2216 call assert_fails("echo prop_list(1, {'types': ['one', 10],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2217 \ 'end_lnum': 10})", 'E928:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2218 call assert_fails("echo prop_list(1, {'types': ['']})", 'E971:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2219 call assert_equal([], prop_list(2, {'types': []}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2220 call assert_equal([], prop_list(2, {'types': test_null_list()}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2221 call assert_fails("call prop_list(1, {'types': {}})", 'E714:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2222 call assert_fails("call prop_list(1, {'types': 'one'})", 'E714:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2223 call assert_equal([], prop_list(2, {'types': ['one'],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2224 \ 'ids': test_null_list()}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2225 call assert_equal([], prop_list(2, {'types': ['one'], 'ids': []}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2226 call assert_fails("call prop_list(1, {'types': ['one'], 'ids': {}})",
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2227 \ 'E714:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2228 call assert_fails("call prop_list(1, {'types': ['one'], 'ids': 10})",
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2229 \ 'E714:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2230 call assert_fails("call prop_list(1, {'types': ['one'], 'ids': [[]]})",
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2231 \ 'E745:')
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2232 call assert_fails("call prop_list(1, {'types': ['one'], 'ids': [10, []]})",
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2233 \ 'E745:')
25392
b427a26b0210 patch 8.2.3233: prop_list() and prop_find() do not indicate the buffer
Bram Moolenaar <Bram@vim.org>
parents: 25198
diff changeset
2234
26242
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2235 #" get text properties from a non-current buffer
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2236 wincmd w
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2237 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2238 \ {'lnum': 1, 'id': 5, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2239 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2240 \ {'lnum': 1, 'id': 10, 'col': 5, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2241 \ 'type': 'two', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2242 \ {'lnum': 3, 'id': 20, 'col': 12, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2243 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2244 \ {'lnum': 3, 'id': 10, 'col': 13, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2245 \ 'type': 'two', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2246 \ prop_list(1, {'bufnr': winbufnr(1), 'end_lnum': 4}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2247 wincmd w
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2248
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2249 #" get text properties after clearing all the properties
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2250 call prop_clear(1, line('$'))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2251 call assert_equal([], prop_list(1, {'end_lnum': 10}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2252
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2253 call prop_add(2, 4, {'type': 'one', 'id': 5, 'end_col': 6})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2254 call prop_add(2, 4, {'type': 'two', 'id': 10, 'end_col': 6})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2255 call prop_add(2, 4, {'type': 'three', 'id': 15, 'end_col': 6})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2256 #" get text properties with a list of types
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2257 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2258 \ {'id': 10, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2259 \ 'type': 'two', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2260 \ {'id': 5, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2261 \ 'type': 'one', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2262 \ prop_list(2, {'types': ['one', 'two']}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2263 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2264 \ {'id': 15, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2265 \ 'type': 'three', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2266 \ {'id': 5, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2267 \ 'type': 'one', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2268 \ prop_list(2, {'types': ['one', 'three']}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2269 #" get text properties with a list of identifiers
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2270 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2271 \ {'id': 10, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2272 \ 'type': 'two', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2273 \ {'id': 5, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2274 \ 'type': 'one', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2275 \ prop_list(2, {'ids': [5, 10, 20]}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2276 call prop_clear(1, line('$'))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2277 call assert_equal([], prop_list(2, {'types': ['one', 'two']}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2278 call assert_equal([], prop_list(2, {'ids': [5, 10, 20]}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2279
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2280 #" get text properties from a hidden buffer
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2281 edit! Xaaa
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2282 call setline(1, repeat([repeat('b', 60)], 10))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2283 call prop_add(1, 4, {'type': 'one', 'id': 5, 'end_col': 6})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2284 call prop_add(4, 8, {'type': 'two', 'id': 10, 'end_col': 10})
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2285 VAR bnr = bufnr()
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2286 hide edit Xbbb
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2287 call assert_equal([
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2288 \ {'lnum': 1, 'id': 5, 'col': 4, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2289 \ 'type': 'one', 'length': 2, 'start': 1},
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2290 \ {'lnum': 4, 'id': 10, 'col': 8, 'type_bufnr': 0, 'end': 1,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2291 \ 'type': 'two', 'length': 2, 'start': 1}],
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2292 \ prop_list(1, {'bufnr': bnr,
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2293 \ 'types': ['one', 'two'], 'ids': [5, 10], 'end_lnum': -1}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2294 #" get text properties from an unloaded buffer
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2295 bunload! Xaaa
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2296 call assert_equal([], prop_list(1, {'bufnr': bnr, 'end_lnum': -1}))
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2297
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26384
diff changeset
2298 call g:DeletePropTypes()
26242
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2299 :%bw!
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2300 END
27457
4c16acb2525f patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 26384
diff changeset
2301 call v9.CheckLegacyAndVim9Success(lines)
26242
685206b54ecf patch 8.2.3652: can only get text properties one line at a time
Bram Moolenaar <Bram@vim.org>
parents: 25674
diff changeset
2302 endfunc
23306
90ea5037a7e3 patch 8.2.2198: ml_get error when resizing window and using text property
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
2303
28526
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2304 func Test_prop_find_prev_on_same_line()
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2305 new
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2306
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2307 call setline(1, 'the quikc bronw fox jumsp over the layz dog')
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2308 call prop_type_add('misspell', #{highlight: 'ErrorMsg'})
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2309 for col in [8, 14, 24, 38]
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2310 call prop_add(1, col, #{type: 'misspell', length: 2})
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2311 endfor
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2312
29788
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
2313 call cursor(1, 18)
28526
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2314 let expected = [
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2315 \ #{lnum: 1, id: 0, col: 14, end: 1, type: 'misspell', type_bufnr: 0, length: 2, start: 1},
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2316 \ #{lnum: 1, id: 0, col: 24, end: 1, type: 'misspell', type_bufnr: 0, length: 2, start: 1}
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2317 \ ]
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2318
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2319 let result = prop_find(#{type: 'misspell'}, 'b')
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2320 call assert_equal(expected[0], result)
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2321 let result = prop_find(#{type: 'misspell'}, 'f')
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2322 call assert_equal(expected[1], result)
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2323
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2324 call prop_type_delete('misspell')
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2325 bwipe!
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2326 endfunc
171f9def0398 patch 8.2.4787: prop_find() does not find the right property
Bram Moolenaar <Bram@vim.org>
parents: 27626
diff changeset
2327
28848
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2328 func Test_prop_spell()
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2329 new
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2330 set spell
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2331 call AddPropTypes()
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2332
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2333 call setline(1, ["helo world", "helo helo helo"])
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2334 call prop_add(1, 1, #{type: 'one', length: 4})
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2335 call prop_add(1, 6, #{type: 'two', length: 5})
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2336 call prop_add(2, 1, #{type: 'three', length: 4})
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2337 call prop_add(2, 6, #{type: 'three', length: 4})
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2338 call prop_add(2, 11, #{type: 'three', length: 4})
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2339
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2340 " The first prop over 'helo' increases its length after the word is corrected
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2341 " to 'Hello', the second one is shifted to the right.
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2342 let expected = [
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2343 \ {'id': 0, 'col': 1, 'type_bufnr': 0, 'end': 1, 'type': 'one',
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2344 \ 'length': 5, 'start': 1},
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2345 \ {'id': 0, 'col': 7, 'type_bufnr': 0, 'end': 1, 'type': 'two',
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2346 \ 'length': 5, 'start': 1}
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2347 \ ]
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2348 call feedkeys("z=1\<CR>", 'xt')
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2349
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2350 call assert_equal('Hello world', getline(1))
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2351 call assert_equal(expected, prop_list(1))
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2352
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2353 " Repeat the replacement done by z=
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2354 spellrepall
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2355
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2356 let expected = [
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2357 \ {'id': 0, 'col': 1, 'type_bufnr': 0, 'end': 1, 'type': 'three',
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2358 \ 'length': 5, 'start': 1},
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2359 \ {'id': 0, 'col': 7, 'type_bufnr': 0, 'end': 1, 'type': 'three',
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2360 \ 'length': 5, 'start': 1},
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2361 \ {'id': 0, 'col': 13, 'type_bufnr': 0, 'end': 1, 'type': 'three',
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2362 \ 'length': 5, 'start': 1}
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2363 \ ]
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2364 call assert_equal('Hello Hello Hello', getline(2))
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2365 call assert_equal(expected, prop_list(2))
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2366
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2367 call DeletePropTypes()
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2368 set spell&
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2369 bwipe!
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2370 endfunc
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2371
28854
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2372 func Test_prop_shift_block()
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2373 new
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2374 call AddPropTypes()
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2375
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2376 call setline(1, ['some highlighted text']->repeat(2))
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2377 call prop_add(1, 10, #{type: 'one', length: 11})
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2378 call prop_add(2, 10, #{type: 'two', length: 11})
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2379
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2380 call cursor(1, 1)
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2381 call feedkeys("5l\<c-v>>", 'nxt')
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2382 call cursor(2, 1)
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2383 call feedkeys("5l\<c-v><", 'nxt')
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2384
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2385 let expected = [
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2386 \ {'lnum': 1, 'id': 0, 'col': 8, 'type_bufnr': 0, 'end': 1, 'type': 'one',
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2387 \ 'length': 11, 'start' : 1},
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2388 \ {'lnum': 2, 'id': 0, 'col': 6, 'type_bufnr': 0, 'end': 1, 'type': 'two',
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2389 \ 'length': 11, 'start' : 1}
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2390 \ ]
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2391 call assert_equal(expected, prop_list(1, #{end_lnum: 2}))
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2392
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2393 call DeletePropTypes()
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2394 bwipe!
647d7f439622 patch 8.2.4950: text properties position wrong after shifting text
Bram Moolenaar <Bram@vim.org>
parents: 28848
diff changeset
2395 endfunc
28848
ba81f4ed59e2 patch 8.2.4947: text properties not adjusted when accepting spell suggestion
Bram Moolenaar <Bram@vim.org>
parents: 28841
diff changeset
2396
28863
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2397 func Test_prop_insert_multiline()
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2398 new
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2399 call AddPropTypes()
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2400
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2401 call setline(1, ['foobar', 'barbaz'])
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2402 call prop_add(1, 4, #{end_lnum: 2, end_col: 4, type: 'one'})
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2403
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2404 call feedkeys("1Goquxqux\<Esc>", 'nxt')
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2405 call feedkeys("2GOquxqux\<Esc>", 'nxt')
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2406
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2407 let lines =<< trim END
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2408 foobar
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2409 quxqux
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2410 quxqux
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2411 barbaz
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2412 END
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2413 call assert_equal(lines, getline(1, '$'))
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2414 let expected = [
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2415 \ {'lnum': 1, 'id': 0, 'col': 4, 'type_bufnr': 0, 'end': 0, 'type': 'one',
29788
d08aa1bfe319 patch 9.0.0233: removing multiple text properties takes many calls
Bram Moolenaar <Bram@vim.org>
parents: 29748
diff changeset
2416 \ 'length': 4 , 'start': 1},
28863
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2417 \ {'lnum': 2, 'id': 0, 'col': 1, 'type_bufnr': 0, 'end': 0, 'type': 'one',
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2418 \ 'length': 7, 'start': 0},
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2419 \ {'lnum': 3, 'id': 0, 'col': 1, 'type_bufnr': 0, 'end': 0, 'type': 'one',
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2420 \ 'length': 7, 'start': 0},
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2421 \ {'lnum': 4, 'id': 0, 'col': 1, 'type_bufnr': 0, 'end': 1, 'type': 'one',
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2422 \ 'length': 3, 'start': 0}
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2423 \ ]
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2424 call assert_equal(expected, prop_list(1, #{end_lnum: 10}))
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2425
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2426 call DeletePropTypes()
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2427 bwipe!
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2428 endfunc
92736a673e3c patch 8.2.4954: inserting line breaks text property spanning two lines
Bram Moolenaar <Bram@vim.org>
parents: 28854
diff changeset
2429
28869
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2430 func Test_prop_blockwise_change()
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2431 new
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2432 call AddPropTypes()
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2433
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2434 call setline(1, ['foooooo', 'bar', 'baaaaz'])
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2435 call prop_add(1, 1, #{end_col: 3, type: 'one'})
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2436 call prop_add(2, 1, #{end_col: 3, type: 'two'})
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2437 call prop_add(3, 1, #{end_col: 3, type: 'three'})
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2438
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2439 " Replace the first two columns with '123', since 'start_incl' is false the
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2440 " prop is not extended.
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2441 call feedkeys("gg\<c-v>2jc123\<Esc>", 'nxt')
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2442
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2443 let lines =<< trim END
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2444 123oooooo
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2445 123ar
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2446 123aaaaz
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2447 END
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2448 call assert_equal(lines, getline(1, '$'))
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2449 let expected = [
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2450 \ {'lnum': 1, 'id': 0, 'col': 4, 'type_bufnr': 0, 'end': 1, 'type': 'one',
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2451 \ 'length': 1, 'start': 1},
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2452 \ {'lnum': 2, 'id': 0, 'col': 4, 'type_bufnr': 0, 'end': 1, 'type': 'two',
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2453 \ 'length': 1, 'start': 1},
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2454 \ {'lnum': 3, 'id': 0, 'col': 4, 'type_bufnr': 0, 'end': 1 ,
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2455 \ 'type': 'three', 'length': 1, 'start': 1}
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2456 \ ]
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2457 call assert_equal(expected, prop_list(1, #{end_lnum: 10}))
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2458
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2459 call DeletePropTypes()
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2460 bwipe!
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2461 endfunc
6a4edacbd178 patch 8.2.4957: text properties in a wrong position after a block change
Bram Moolenaar <Bram@vim.org>
parents: 28865
diff changeset
2462
28984
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2463 func Do_test_props_do_not_affect_byte_offsets(ff, increment)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2464 new
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2465 let lcount = 410
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2466
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2467 " File format affects byte-offset calculations, so make sure it is known.
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2468 exec 'setlocal fileformat=' . a:ff
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2469
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2470 " Fill the buffer with varying length lines. We need a suitably large number
30986
360f286b5869 patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents: 30900
diff changeset
2471 " to force Vim code through paths where previous error have occurred. This
28984
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2472 " is more 'art' than 'science'.
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2473 let text = 'a'
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2474 call setline(1, text)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2475 let offsets = [1]
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2476 for idx in range(lcount)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2477 call add(offsets, offsets[idx] + len(text) + a:increment)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2478 if (idx % 6) == 0
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2479 let text = text . 'a'
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2480 endif
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2481 call append(line('$'), text)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2482 endfor
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2483
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2484 " Set a property that spans a few lines to cause Vim's internal buffer code
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2485 " to perform a reasonable amount of rearrangement.
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2486 call prop_type_add('one', {'highlight': 'ErrorMsg'})
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2487 call prop_add(1, 1, {'type': 'one', 'end_lnum': 6, 'end_col': 2})
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2488
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2489 for idx in range(lcount)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2490 let boff = line2byte(idx + 1)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2491 call assert_equal(offsets[idx], boff, 'Bad byte offset at line ' . (idx + 1))
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2492 endfor
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2493
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2494 call prop_type_delete('one')
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2495 bwipe!
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2496 endfunc
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2497
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2498 func Test_props_do_not_affect_byte_offsets()
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2499 call Do_test_props_do_not_affect_byte_offsets('unix', 1)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2500 endfunc
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2501
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2502 func Test_props_do_not_affect_byte_offsets_dos()
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2503 call Do_test_props_do_not_affect_byte_offsets('dos', 2)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2504 endfunc
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2505
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2506 func Test_props_do_not_affect_byte_offsets_editline()
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2507 new
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2508 let lcount = 410
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2509
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2510 " File format affects byte-offset calculations, so make sure it is known.
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2511 setlocal fileformat=unix
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2512
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2513 " Fill the buffer with varying length lines. We need a suitably large number
30986
360f286b5869 patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents: 30900
diff changeset
2514 " to force Vim code through paths where previous error have occurred. This
28984
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2515 " is more 'art' than 'science'.
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2516 let text = 'aa'
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2517 call setline(1, text)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2518 let offsets = [1]
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2519 for idx in range(lcount)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2520 call add(offsets, offsets[idx] + len(text) + 1)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2521 if (idx % 6) == 0
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2522 let text = text . 'a'
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2523 endif
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2524 call append(line('$'), text)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2525 endfor
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2526
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2527 " Set a property that just covers the first line. When this test was
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2528 " developed, this did not trigger a byte-offset error.
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2529 call prop_type_add('one', {'highlight': 'ErrorMsg'})
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2530 call prop_add(1, 1, {'type': 'one', 'end_lnum': 1, 'end_col': 3})
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2531
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2532 for idx in range(lcount)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2533 let boff = line2byte(idx + 1)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2534 call assert_equal(offsets[idx], boff,
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2535 \ 'Confounding bad byte offset at line ' . (idx + 1))
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2536 endfor
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2537
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2538 " Insert text in the middle of the first line, keeping the property
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2539 " unchanged.
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2540 :1
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2541 normal aHello
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2542 for idx in range(1, lcount)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2543 let offsets[idx] = offsets[idx] + 5
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2544 endfor
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2545
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2546 for idx in range(lcount)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2547 let boff = line2byte(idx + 1)
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2548 call assert_equal(offsets[idx], boff,
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2549 \ 'Bad byte offset at line ' . (idx + 1))
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2550 endfor
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2551
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2552 call prop_type_delete('one')
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2553 bwipe!
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2554 endfunc
b3828315a0d9 patch 8.2.5014: byte offsets are wrong when using text properties
Bram Moolenaar <Bram@vim.org>
parents: 28931
diff changeset
2555
29451
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2556 func Test_prop_inserts_text()
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2557 CheckRunVimInTerminal
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2558
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2559 " Just a basic check for now
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2560 let lines =<< trim END
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2561 call setline(1, 'insert some text here and other text there and some more text after wrapping')
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2562 call prop_type_add('someprop', #{highlight: 'ErrorMsg'})
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2563 call prop_type_add('otherprop', #{highlight: 'Search'})
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2564 call prop_type_add('moreprop', #{highlight: 'DiffAdd'})
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2565 call prop_add(1, 18, #{type: 'someprop', text: 'SOME '})
29581
4a79bca8a76e patch 9.0.0131: virtual text with Tab is not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29579
diff changeset
2566 call prop_add(1, 38, #{type: 'otherprop', text: "OTHER\t"})
29451
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2567 call prop_add(1, 69, #{type: 'moreprop', text: 'MORE '})
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2568 normal $
29583
32aee589fc9a patch 9.0.0132: multi-byte characters in virtual text not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 29581
diff changeset
2569
32aee589fc9a patch 9.0.0132: multi-byte characters in virtual text not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 29581
diff changeset
2570 call setline(2, 'prepost')
32aee589fc9a patch 9.0.0132: multi-byte characters in virtual text not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 29581
diff changeset
2571 call prop_type_add('multibyte', #{highlight: 'Visual'})
32aee589fc9a patch 9.0.0132: multi-byte characters in virtual text not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 29581
diff changeset
2572 call prop_add(2, 4, #{type: 'multibyte', text: 'söme和平téxt'})
29605
0340a59e04ca patch 9.0.0143: cursor positioned after virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29597
diff changeset
2573
29655
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2574 call setline(3, 'Foo foo = { 1, 2 };')
29692
042f357b455d patch 9.0.0186: virtual text without highlighting does not show
Bram Moolenaar <Bram@vim.org>
parents: 29690
diff changeset
2575 call prop_type_add('testprop', #{highlight: 'Comment'})
29655
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2576 call prop_add(3, 13, #{type: 'testprop', text: '.x='})
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2577 call prop_add(3, 16, #{type: 'testprop', text: '.y='})
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2578
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2579 call setline(4, '')
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2580 call prop_add(4, 1, #{type: 'someprop', text: 'empty line'})
29692
042f357b455d patch 9.0.0186: virtual text without highlighting does not show
Bram Moolenaar <Bram@vim.org>
parents: 29690
diff changeset
2581
042f357b455d patch 9.0.0186: virtual text without highlighting does not show
Bram Moolenaar <Bram@vim.org>
parents: 29690
diff changeset
2582 call setline(5, 'look highlight')
042f357b455d patch 9.0.0186: virtual text without highlighting does not show
Bram Moolenaar <Bram@vim.org>
parents: 29690
diff changeset
2583 call prop_type_add('nohi', #{})
042f357b455d patch 9.0.0186: virtual text without highlighting does not show
Bram Moolenaar <Bram@vim.org>
parents: 29690
diff changeset
2584 call prop_add(5, 6, #{type: 'nohi', text: 'no '})
29451
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2585 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2586 call writefile(lines, 'XscriptPropsWithText', 'D')
29655
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2587 let buf = RunVimInTerminal('-S XscriptPropsWithText', #{rows: 8, cols: 60})
29550
ec5f48ab361b patch 9.0.0116: virtual text not displayed if 'signcolumn' is "yes"
Bram Moolenaar <Bram@vim.org>
parents: 29451
diff changeset
2588 call VerifyScreenDump(buf, 'Test_prop_inserts_text_1', {})
ec5f48ab361b patch 9.0.0116: virtual text not displayed if 'signcolumn' is "yes"
Bram Moolenaar <Bram@vim.org>
parents: 29451
diff changeset
2589
ec5f48ab361b patch 9.0.0116: virtual text not displayed if 'signcolumn' is "yes"
Bram Moolenaar <Bram@vim.org>
parents: 29451
diff changeset
2590 call term_sendkeys(buf, ":set signcolumn=yes\<CR>")
ec5f48ab361b patch 9.0.0116: virtual text not displayed if 'signcolumn' is "yes"
Bram Moolenaar <Bram@vim.org>
parents: 29451
diff changeset
2591 call VerifyScreenDump(buf, 'Test_prop_inserts_text_2', {})
29451
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2592
29605
0340a59e04ca patch 9.0.0143: cursor positioned after virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29597
diff changeset
2593 call term_sendkeys(buf, "2G$")
0340a59e04ca patch 9.0.0143: cursor positioned after virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29597
diff changeset
2594 call VerifyScreenDump(buf, 'Test_prop_inserts_text_3', {})
0340a59e04ca patch 9.0.0143: cursor positioned after virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29597
diff changeset
2595
29655
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2596 call term_sendkeys(buf, "3Gf1")
29605
0340a59e04ca patch 9.0.0143: cursor positioned after virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29597
diff changeset
2597 call VerifyScreenDump(buf, 'Test_prop_inserts_text_4', {})
29655
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2598 call term_sendkeys(buf, "f2")
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2599 call VerifyScreenDump(buf, 'Test_prop_inserts_text_5', {})
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2600
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2601 call term_sendkeys(buf, "4G")
53e434838a85 patch 9.0.0168: cursor positioned wrong with two virtual text properties
Bram Moolenaar <Bram@vim.org>
parents: 29645
diff changeset
2602 call VerifyScreenDump(buf, 'Test_prop_inserts_text_6', {})
29605
0340a59e04ca patch 9.0.0143: cursor positioned after virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29597
diff changeset
2603
29451
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2604 call StopVimInTerminal(buf)
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2605 endfunc
057c26b5c33a patch 9.0.0067: cannot show virtual text
Bram Moolenaar <Bram@vim.org>
parents: 28984
diff changeset
2606
29706
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2607 func Test_prop_inserts_text_highlight()
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2608 CheckRunVimInTerminal
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2609
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2610 " Just a basic check for now
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2611 let lines =<< trim END
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2612 call setline(1, 'insert some text (here) and there')
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2613 call prop_type_add('someprop', #{highlight: 'ErrorMsg'})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2614 let bef_prop = prop_add(1, 18, #{type: 'someprop', text: 'BEFORE'})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2615 set hlsearch
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2616 let thematch = matchaddpos("DiffAdd", [[1, 18]])
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2617 func DoAfter()
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2618 call prop_remove(#{id: g:bef_prop})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2619 call prop_add(1, 19, #{type: 'someprop', text: 'AFTER'})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2620 let g:thematch = matchaddpos("DiffAdd", [[1, 18]])
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2621 let @/ = ''
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2622 endfunc
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2623 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2624 call writefile(lines, 'XscriptPropsWithHighlight', 'D')
29706
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2625 let buf = RunVimInTerminal('-S XscriptPropsWithHighlight', #{rows: 6, cols: 60})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2626 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_1', {})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2627 call term_sendkeys(buf, "/text (he\<CR>")
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2628 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_2', {})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2629 call term_sendkeys(buf, ":call matchdelete(thematch)\<CR>")
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2630 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_3', {})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2631
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2632 call term_sendkeys(buf, ":call DoAfter()\<CR>")
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2633 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_4', {})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2634 call term_sendkeys(buf, "/text (he\<CR>")
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2635 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_5', {})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2636 call term_sendkeys(buf, ":call matchdelete(thematch)\<CR>")
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2637 call VerifyScreenDump(buf, 'Test_prop_inserts_text_hi_6', {})
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2638
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2639 call StopVimInTerminal(buf)
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2640 endfunc
a680dc1b089d patch 9.0.0193: search and match highlgith interfere with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29696
diff changeset
2641
33000
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2642 func Test_prop_inserts_text_normal_gM()
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2643 CheckRunVimInTerminal
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2644
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2645 let lines =<< trim END
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2646 call setline(1, '123456789')
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2647 call prop_type_add('theprop', #{highlight: 'Special'})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2648 call prop_add(1, 3, {'type': 'theprop', 'text': 'bbb'})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2649 call prop_add(1, 8, {'type': 'theprop', 'text': 'bbb'})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2650 END
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2651 call writefile(lines, 'XscriptPropsNormal_gM', 'D')
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2652 let buf = RunVimInTerminal('-S XscriptPropsNormal_gM', #{rows: 3, cols: 60})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2653 call term_sendkeys(buf, "gM")
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2654 call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gM', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2655
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2656 call StopVimInTerminal(buf)
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2657 endfunc
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2658
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2659 func Run_test_prop_inserts_text_normal_gj_gk(cmd)
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2660 CheckRunVimInTerminal
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2661
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2662 let lines =<< trim END
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2663 call setline(1, repeat([repeat('a', 55)], 2))
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2664 call prop_type_add('theprop', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2665 call prop_add(1, 41, {'type': 'theprop', 'text': repeat('b', 10)})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2666 call prop_add(2, 41, {'type': 'theprop', 'text': repeat('b', 10)})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2667 END
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2668 let lines = insert(lines, a:cmd)
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2669 call writefile(lines, 'XscriptPropsNormal_gj_gk', 'D')
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2670 let buf = RunVimInTerminal('-S XscriptPropsNormal_gj_gk', #{rows: 6, cols: 60})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2671 call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_1', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2672 call term_sendkeys(buf, "gj")
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2673 call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_2', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2674 call term_sendkeys(buf, "gj")
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2675 call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_3', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2676 call term_sendkeys(buf, "gj")
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2677 call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_4', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2678 call term_sendkeys(buf, "gk")
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2679 call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_5', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2680 call term_sendkeys(buf, "gk")
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2681 call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_6', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2682 call term_sendkeys(buf, "gk")
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2683 call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_7', {})
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2684
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2685 call StopVimInTerminal(buf)
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2686 endfunc
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2687
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2688 func Test_prop_inserts_text_normal_gj_gk()
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2689 call Run_test_prop_inserts_text_normal_gj_gk('')
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2690 call Run_test_prop_inserts_text_normal_gj_gk('set virtualedit=all')
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2691 endfunc
bc3b293a965c patch 9.0.1792: problem with gj/gk/gM and virtual text
Christian Brabandt <cb@256bit.org>
parents: 32984
diff changeset
2692
34623
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2693 func Test_prop_normal_gj_gk_over_outer_virtual_text()
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2694 CheckRunVimInTerminal
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2695
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2696 let lines =<< trim END
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2697 vim9script
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2698 setlocal number
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2699 setline(1, ['First line fits on screen line.', '', 'Third line fits on screen line.'])
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2700
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2701 var vt = 'test'
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2702 prop_type_add(vt, {highlight: 'ToDo'})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2703 for ln in range(1, line('$'))
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2704 prop_add(ln, 0, {type: vt, text: 'Above', text_align: 'above'})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2705 prop_add(ln, 0, {type: vt, text: 'After text wraps to next line.', text_align: 'after', text_wrap: 'wrap'})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2706 prop_add(ln, 0, {type: vt, text: 'Right text wraps to next line.', text_align: 'right', text_wrap: 'wrap'})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2707 prop_add(ln, 0, {type: vt, text: 'Below', text_align: 'below'})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2708 endfor
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2709 normal 3l
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2710 END
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2711 call writefile(lines, 'XscriptPropsNormal_gj_gk_over_outer', 'D')
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2712 let buf = RunVimInTerminal('-S XscriptPropsNormal_gj_gk_over_outer', #{rows: 16, cols: 40})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2713 call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_1', {})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2714
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2715 call term_sendkeys(buf, "gj")
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2716 call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_2', {})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2717 call term_sendkeys(buf, "gj")
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2718 call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_3', {})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2719 call term_sendkeys(buf, "gk")
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2720 call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_2', {})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2721 call term_sendkeys(buf, "gk")
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2722 call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_1', {})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2723
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2724 call term_sendkeys(buf, "2gj")
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2725 call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_3', {})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2726 call term_sendkeys(buf, "2gk")
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2727 call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_1', {})
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2728
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2729 call StopVimInTerminal(buf)
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2730 endfunc
65e7eaf68f19 patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Christian Brabandt <cb@256bit.org>
parents: 34593
diff changeset
2731
32838
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2732 func Test_prop_inserts_text_visual_block()
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2733 CheckRunVimInTerminal
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2734
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2735 let lines =<< trim END
32872
7a1a9ce831c3 patch 9.0.1745: Missing test coverage for blockwise Visual highlight
Christian Brabandt <cb@256bit.org>
parents: 32838
diff changeset
2736 call setline(1, repeat(['123456789'], 4))
32838
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2737 call prop_type_add('theprop', #{highlight: 'Special'})
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2738 call prop_add(2, 2, {'type': 'theprop', 'text': '-口-'})
32872
7a1a9ce831c3 patch 9.0.1745: Missing test coverage for blockwise Visual highlight
Christian Brabandt <cb@256bit.org>
parents: 32838
diff changeset
2739 call prop_add(3, 3, {'type': 'theprop', 'text': '口'})
32838
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2740 END
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2741 call writefile(lines, 'XscriptPropsVisualBlock', 'D')
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2742 let buf = RunVimInTerminal('-S XscriptPropsVisualBlock', #{rows: 6, cols: 60})
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2743 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_1', {})
32872
7a1a9ce831c3 patch 9.0.1745: Missing test coverage for blockwise Visual highlight
Christian Brabandt <cb@256bit.org>
parents: 32838
diff changeset
2744 call term_sendkeys(buf, "\<C-V>3jl")
32838
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2745 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_2', {})
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2746 call term_sendkeys(buf, "l")
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2747 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_3', {})
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2748 call term_sendkeys(buf, "4l")
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2749 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_4', {})
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2750 call term_sendkeys(buf, "Ol")
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2751 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_5', {})
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2752 call term_sendkeys(buf, "l")
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2753 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_6', {})
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2754 call term_sendkeys(buf, "l")
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2755 call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_7', {})
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2756
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2757 call StopVimInTerminal(buf)
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2758 endfunc
eaf22d1df3c1 patch 9.0.1731: blockwise Visual highlight not working with virtual text
Christian Brabandt <cb@256bit.org>
parents: 32752
diff changeset
2759
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2760 func Run_test_prop_inserts_text_showbreak(cmd)
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2761 CheckRunVimInTerminal
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2762
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2763 let lines =<< trim END
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2764 highlight! link LineNr Normal
33017
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2765 setlocal number showbreak=+ breakindent breakindentopt=shift:2
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2766 setlocal scrolloff=0 smoothscroll
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2767 call setline(1, repeat('a', 28))
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2768 call prop_type_add('theprop', #{highlight: 'Special'})
33138
22a29cc413c5 patch 9.0.1851: breakindent missing by virt text
Christian Brabandt <cb@256bit.org>
parents: 33103
diff changeset
2769 call prop_add(1, 28, #{type: 'theprop', text: repeat('123', 23)})
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2770 normal! $
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2771 END
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2772 let lines = insert(lines, a:cmd)
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2773 call writefile(lines, 'XscriptPropsShowbreak', 'D')
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2774 let buf = RunVimInTerminal('-S XscriptPropsShowbreak', #{rows: 6, cols: 30})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2775 call term_sendkeys(buf, ":set noruler\<CR>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2776 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_1', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2777 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2778 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_2', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2779 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2780 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_3', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2781 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2782 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_4', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2783 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2784 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_5', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2785 call term_sendkeys(buf, "zbi")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2786 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_6', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2787 call term_sendkeys(buf, "\<BS>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2788 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_7', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2789 call term_sendkeys(buf, "\<Esc>l")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2790 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_8', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2791 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2792 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_9', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2793 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2794 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_10', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2795 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2796 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_11', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2797 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2798 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_12', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2799 call term_sendkeys(buf, "023x$")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2800 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_13', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2801 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2802 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_14', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2803 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2804 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_15', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2805 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2806 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_16', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2807 call term_sendkeys(buf, "zbi")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2808 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_17', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2809 call term_sendkeys(buf, "\<C-U>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2810 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_18', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2811 call term_sendkeys(buf, "\<Esc>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2812 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_19', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2813 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2814 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_20', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2815 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2816 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_21', {})
32977
68a12270d21b patch 9.0.1785: wrong cursor position with 'showbreak' and lcs-eol
Christian Brabandt <cb@256bit.org>
parents: 32971
diff changeset
2817 call term_sendkeys(buf, "zbx")
68a12270d21b patch 9.0.1785: wrong cursor position with 'showbreak' and lcs-eol
Christian Brabandt <cb@256bit.org>
parents: 32971
diff changeset
2818 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_22', {})
33017
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2819 call term_sendkeys(buf, "26ia\<Esc>a")
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2820 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_23', {})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2821 call term_sendkeys(buf, "\<C-\>\<C-O>:setlocal breakindentopt=\<CR>")
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2822 call VerifyScreenDump(buf, 'Test_prop_inserts_text_showbreak_24', {})
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2823
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2824 call StopVimInTerminal(buf)
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2825 endfunc
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2826
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2827 func Test_prop_inserts_text_showbreak()
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2828 call Run_test_prop_inserts_text_showbreak('')
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2829 " because of 'breakindent' the screendumps are the same
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2830 call Run_test_prop_inserts_text_showbreak('set cpoptions+=n')
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2831 endfunc
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2832
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2833 func Test_prop_before_tab_skipcol()
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2834 CheckRunVimInTerminal
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2835
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2836 let lines =<< trim END
33017
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2837 setlocal list listchars=tab:<-> scrolloff=0 smoothscroll
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2838 call setline(1, repeat("\t", 4) .. 'a')
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2839 call prop_type_add('theprop', #{highlight: 'Special'})
33138
22a29cc413c5 patch 9.0.1851: breakindent missing by virt text
Christian Brabandt <cb@256bit.org>
parents: 33103
diff changeset
2840 call prop_add(1, 4, #{type: 'theprop', text: repeat('12', 32)})
32971
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2841 normal! $
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2842 END
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2843 call writefile(lines, 'XscriptPropsBeforeTabSkipcol', 'D')
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2844 let buf = RunVimInTerminal('-S XscriptPropsBeforeTabSkipcol', #{rows: 6, cols: 30})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2845 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_1', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2846 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2847 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_2', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2848 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2849 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_3', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2850 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2851 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_4', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2852 call term_sendkeys(buf, "zbh")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2853 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_5', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2854 call term_sendkeys(buf, "i")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2855 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_6', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2856 call term_sendkeys(buf, "\<C-O>:setlocal nolist\<CR>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2857 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_7', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2858 call term_sendkeys(buf, "\<Esc>l")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2859 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_8', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2860 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2861 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_9', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2862 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2863 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_10', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2864 call term_sendkeys(buf, "\<C-E>")
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2865 call VerifyScreenDump(buf, 'Test_prop_before_tab_skipcol_11', {})
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2866
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2867 call StopVimInTerminal(buf)
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2868 endfunc
ccfca4f03a2b Some more missing changes :(
Christian Brabandt <cb@256bit.org>
parents: 32964
diff changeset
2869
33077
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2870 func Test_prop_inserts_text_before_linebreak()
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2871 CheckRunVimInTerminal
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2872
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2873 let lines =<< trim END
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2874 setlocal linebreak showbreak=+ breakindent breakindentopt=shift:2
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2875 call setline(1, repeat('a', 50) .. ' ' .. repeat('c', 45))
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2876 call prop_type_add('theprop', #{highlight: 'Special'})
33138
22a29cc413c5 patch 9.0.1851: breakindent missing by virt text
Christian Brabandt <cb@256bit.org>
parents: 33103
diff changeset
2877 call prop_add(1, 51, #{type: 'theprop', text: repeat('b', 10)})
33077
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2878 normal! $
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2879 END
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2880 call writefile(lines, 'XscriptPropsBeforeLinebreak', 'D')
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2881 let buf = RunVimInTerminal('-S XscriptPropsBeforeLinebreak', #{rows: 6, cols: 50})
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2882 call VerifyScreenDump(buf, 'Test_prop_inserts_text_before_linebreak_1', {})
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2883 call term_sendkeys(buf, '05x$')
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2884 call VerifyScreenDump(buf, 'Test_prop_inserts_text_before_linebreak_2', {})
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2885
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2886 call StopVimInTerminal(buf)
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2887 endfunc
d03841a271aa patch 9.0.1825: wrong cursor position with virt text and 'linebreak'
Christian Brabandt <cb@256bit.org>
parents: 33021
diff changeset
2888
33086
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2889 func Test_prop_inserts_text_before_double_width_wrap()
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2890 CheckRunVimInTerminal
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2891
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2892 let lines =<< trim END
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2893 call setline(1, repeat('a', 40) .. '口' .. '12345')
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2894 call prop_type_add('theprop', #{highlight: 'Special'})
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2895 call prop_add(1, 41, #{type: 'theprop', text: repeat('b', 9)})
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2896 normal! $
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2897 END
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2898 call writefile(lines, 'XscriptPropsBeforeDoubleWidthWrap', 'D')
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2899 let buf = RunVimInTerminal('-S XscriptPropsBeforeDoubleWidthWrap', #{rows: 3, cols: 50})
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2900 call VerifyScreenDump(buf, 'Test_prop_inserts_text_before_double_width_wrap_1', {})
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2901
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2902 call StopVimInTerminal(buf)
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2903 endfunc
4be1ffa13b56 patch 9.0.1828: cursor wrong with virt text before double-width char
Christian Brabandt <cb@256bit.org>
parents: 33077
diff changeset
2904
33017
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2905 func Test_prop_inserts_text_lcs_extends()
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2906 CheckRunVimInTerminal
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2907
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2908 let lines =<< trim END
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2909 setlocal nowrap list listchars=extends:!
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2910 call setline(1, repeat('a', &columns + 1))
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2911 call prop_type_add('theprop', #{highlight: 'Special'})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2912 call prop_add(1, &columns + 2, #{type: 'theprop', text: 'bbb'})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2913 END
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2914 call writefile(lines, 'XscriptPropsListExtends', 'D')
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2915 let buf = RunVimInTerminal('-S XscriptPropsListExtends', #{rows: 3, cols: 50})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2916 call term_sendkeys(buf, '20l')
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2917 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_1', {})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2918 call term_sendkeys(buf, 'zl')
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2919 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_2', {})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2920 call term_sendkeys(buf, 'zl')
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2921 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_3', {})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2922 call term_sendkeys(buf, 'zl')
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2923 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_4', {})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2924 call term_sendkeys(buf, 'zl')
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2925 call VerifyScreenDump(buf, 'Test_prop_inserts_text_lcs_extends_5', {})
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2926
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2927 call StopVimInTerminal(buf)
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2928 endfunc
7d0357f70cf8 patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual text
Christian Brabandt <cb@256bit.org>
parents: 33000
diff changeset
2929
30306
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2930 func Test_prop_add_with_text_fails()
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2931 call prop_type_add('failing', #{highlight: 'ErrorMsg'})
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2932 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_lnum: 1})", 'E1305:')
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2933 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', end_col: 1})", 'E1305:')
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2934 call assert_fails("call prop_add(1, 0, #{type: 'failing', text: 'X', length: 1})", 'E1305:')
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2935
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2936 call prop_type_delete('failing')
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2937 endfunc
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2938
29718
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2939 func Test_props_with_text_right_align_twice()
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2940 CheckRunVimInTerminal
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2941
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2942 let lines =<< trim END
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2943 call setline(1, ["some text some text some text some text", 'line two'])
30306
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2944 call prop_type_add('MyErrorText', #{highlight: 'ErrorMsg'})
43d942ff32ce patch 9.0.0489: using "end_lnum" with virtual text causes problems
Bram Moolenaar <Bram@vim.org>
parents: 30304
diff changeset
2945 call prop_type_add('MyPadding', #{highlight: 'DiffChange'})
29918
e6e0f1c39edb patch 9.0.0297: cursor position wrong after right aligned virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29826
diff changeset
2946 call prop_add(1, 0, #{type: 'MyPadding', text: ' nothing here', text_wrap: 'wrap'})
e6e0f1c39edb patch 9.0.0297: cursor position wrong after right aligned virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29826
diff changeset
2947 call prop_add(1, 0, #{type: 'MyErrorText', text: 'Some error', text_wrap: 'wrap', text_align: 'right'})
e6e0f1c39edb patch 9.0.0297: cursor position wrong after right aligned virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29826
diff changeset
2948 call prop_add(1, 0, #{type: 'MyErrorText', text: 'Another error', text_wrap: 'wrap', text_align: 'right'})
29718
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2949 normal G$
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2950 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2951 call writefile(lines, 'XscriptPropsRightAlign', 'D')
29718
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2952 let buf = RunVimInTerminal('-S XscriptPropsRightAlign', #{rows: 8})
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2953 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_1', {})
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2954
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2955 call term_sendkeys(buf, "ggisome more text\<Esc>G$")
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2956 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_2', {})
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2957
29918
e6e0f1c39edb patch 9.0.0297: cursor position wrong after right aligned virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29826
diff changeset
2958 call term_sendkeys(buf, ":set signcolumn=yes\<CR>")
e6e0f1c39edb patch 9.0.0297: cursor position wrong after right aligned virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29826
diff changeset
2959 call VerifyScreenDump(buf, 'Test_prop_right_align_twice_3', {})
e6e0f1c39edb patch 9.0.0297: cursor position wrong after right aligned virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29826
diff changeset
2960
29718
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2961 call StopVimInTerminal(buf)
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2962 endfunc
538204fce2a4 patch 9.0.0199: cursor position wrong with two right-aligned virtual texts
Bram Moolenaar <Bram@vim.org>
parents: 29708
diff changeset
2963
29560
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2964 func Test_props_with_text_after()
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2965 CheckRunVimInTerminal
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2966
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2967 let lines =<< trim END
29615
bab343b21da8 patch 9.0.0148: a "below" aligned text property gets 'showbreak' displayed
Bram Moolenaar <Bram@vim.org>
parents: 29613
diff changeset
2968 set showbreak=+++
29643
b54dfe92ee10 patch 9.0.0162: text property "below" gets indent if 'breakindent' is set
Bram Moolenaar <Bram@vim.org>
parents: 29635
diff changeset
2969 set breakindent
b54dfe92ee10 patch 9.0.0162: text property "below" gets indent if 'breakindent' is set
Bram Moolenaar <Bram@vim.org>
parents: 29635
diff changeset
2970 call setline(1, ' some text here and other text there')
29560
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2971 call prop_type_add('rightprop', #{highlight: 'ErrorMsg'})
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2972 call prop_type_add('afterprop', #{highlight: 'Search'})
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2973 call prop_type_add('belowprop', #{highlight: 'DiffAdd'})
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2974 call prop_add(1, 0, #{type: 'rightprop', text: ' RIGHT ', text_align: 'right'})
29581
4a79bca8a76e patch 9.0.0131: virtual text with Tab is not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29579
diff changeset
2975 call prop_add(1, 0, #{type: 'afterprop', text: "\tAFTER\t", text_align: 'after'})
29560
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2976 call prop_add(1, 0, #{type: 'belowprop', text: ' BELOW ', text_align: 'below'})
29613
1a0aea1e23f4 patch 9.0.0147: cursor positioned wrong after two "below" text properties
Bram Moolenaar <Bram@vim.org>
parents: 29609
diff changeset
2977 call prop_add(1, 0, #{type: 'belowprop', text: ' ALSO BELOW ', text_align: 'below'})
29568
8f71840ecf07 patch 9.0.0125: cursor positioned wrong with virtual text after the line
Bram Moolenaar <Bram@vim.org>
parents: 29560
diff changeset
2978
8f71840ecf07 patch 9.0.0125: cursor positioned wrong with virtual text after the line
Bram Moolenaar <Bram@vim.org>
parents: 29560
diff changeset
2979 call setline(2, 'Last line.')
8f71840ecf07 patch 9.0.0125: cursor positioned wrong with virtual text after the line
Bram Moolenaar <Bram@vim.org>
parents: 29560
diff changeset
2980 call prop_add(2, 0, #{type: 'afterprop', text: ' After Last ', text_align: 'after'})
8f71840ecf07 patch 9.0.0125: cursor positioned wrong with virtual text after the line
Bram Moolenaar <Bram@vim.org>
parents: 29560
diff changeset
2981 normal G$
29583
32aee589fc9a patch 9.0.0132: multi-byte characters in virtual text not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 29581
diff changeset
2982
32aee589fc9a patch 9.0.0132: multi-byte characters in virtual text not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 29581
diff changeset
2983 call setline(3, 'right here')
32aee589fc9a patch 9.0.0132: multi-byte characters in virtual text not handled correctly
Bram Moolenaar <Bram@vim.org>
parents: 29581
diff changeset
2984 call prop_add(3, 0, #{type: 'rightprop', text: 'söme和平téxt', text_align: 'right'})
29560
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2985 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
2986 call writefile(lines, 'XscriptPropsWithTextAfter', 'D')
29613
1a0aea1e23f4 patch 9.0.0147: cursor positioned wrong after two "below" text properties
Bram Moolenaar <Bram@vim.org>
parents: 29609
diff changeset
2987 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfter', #{rows: 8, cols: 60})
29560
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2988 call VerifyScreenDump(buf, 'Test_prop_with_text_after_1', {})
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2989
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2990 call StopVimInTerminal(buf)
29696
c1c599a367d4 patch 9.0.0188: strange effects when using "text_align" with non-zero column
Bram Moolenaar <Bram@vim.org>
parents: 29692
diff changeset
2991
c1c599a367d4 patch 9.0.0188: strange effects when using "text_align" with non-zero column
Bram Moolenaar <Bram@vim.org>
parents: 29692
diff changeset
2992 call assert_fails('call prop_add(1, 2, #{text: "yes", text_align: "right", type: "some"})', 'E1294:')
29560
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2993 endfunc
14b139cbec49 patch 9.0.0121: cannot put virtual text after or below a line
Bram Moolenaar <Bram@vim.org>
parents: 29552
diff changeset
2994
30775
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
2995 func Test_props_with_text_after_and_list()
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
2996 CheckRunVimInTerminal
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
2997
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
2998 let lines =<< trim END
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
2999 vim9script
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3000 setline(1, ['one', 'two'])
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3001 prop_type_add('test', {highlight: 'Special'})
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3002 prop_add(1, 0, {
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3003 type: 'test',
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3004 text: range(50)->join(' '),
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3005 text_align: 'after',
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3006 text_padding_left: 3
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3007 })
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3008 prop_add(1, 0, {
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3009 type: 'test',
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3010 text: range(50)->join('-'),
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3011 text_align: 'after',
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3012 text_padding_left: 5
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3013 })
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3014 prop_add(1, 0, {
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3015 type: 'test',
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3016 text: range(50)->join('.'),
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3017 text_align: 'after',
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3018 text_padding_left: 1
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3019 })
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3020 normal G$
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3021 END
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3022 call writefile(lines, 'XscriptPropsAfter', 'D')
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3023 let buf = RunVimInTerminal('-S XscriptPropsAfter', #{rows: 8, cols: 60})
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3024 call VerifyScreenDump(buf, 'Test_props_after_1', {})
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3025
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3026 call term_sendkeys(buf, ":set list\<CR>")
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3027 call VerifyScreenDump(buf, 'Test_props_after_2', {})
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3028
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3029 call StopVimInTerminal(buf)
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3030 endfunc
a9a46fbfd786 patch 9.0.0722: virtual text "after" does not show with 'list' set
Bram Moolenaar <Bram@vim.org>
parents: 30773
diff changeset
3031
29633
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3032 func Test_props_with_text_after_below_trunc()
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3033 CheckRunVimInTerminal
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3034
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3035 let lines =<< trim END
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3036 vim9script
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3037 edit foobar
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3038 set showbreak=+++
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3039 setline(1, ['onasdf asdf asdf asdf asd fas df', 'two'])
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3040 prop_type_add('test', {highlight: 'Special'})
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3041 prop_add(1, 0, {
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3042 type: 'test',
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3043 text: 'the quick brown fox jumps over the lazy dog',
31221
59de2172e99d patch 9.0.0944: 'cursorline' causes virtual text highlight to continue
Bram Moolenaar <Bram@vim.org>
parents: 31142
diff changeset
3044 text_align: 'after',
29633
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3045 })
31221
59de2172e99d patch 9.0.0944: 'cursorline' causes virtual text highlight to continue
Bram Moolenaar <Bram@vim.org>
parents: 31142
diff changeset
3046 prop_type_add('another', {highlight: 'DiffChange'})
29633
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3047 prop_add(1, 0, {
31221
59de2172e99d patch 9.0.0944: 'cursorline' causes virtual text highlight to continue
Bram Moolenaar <Bram@vim.org>
parents: 31142
diff changeset
3048 type: 'another',
29633
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3049 text: 'the quick brown fox jumps over the lazy dog',
31221
59de2172e99d patch 9.0.0944: 'cursorline' causes virtual text highlight to continue
Bram Moolenaar <Bram@vim.org>
parents: 31142
diff changeset
3050 text_align: 'below',
59de2172e99d patch 9.0.0944: 'cursorline' causes virtual text highlight to continue
Bram Moolenaar <Bram@vim.org>
parents: 31142
diff changeset
3051 text_padding_left: 4,
29633
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3052 })
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3053 normal G$
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3054 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3055 call writefile(lines, 'XscriptPropsAfterTrunc', 'D')
29633
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3056 let buf = RunVimInTerminal('-S XscriptPropsAfterTrunc', #{rows: 8, cols: 60})
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3057 call VerifyScreenDump(buf, 'Test_prop_with_text_after_below_trunc_1', {})
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3058
30767
5dba398584fd patch 9.0.0718: extra empty line between two virtual text "below"
Bram Moolenaar <Bram@vim.org>
parents: 30763
diff changeset
3059 call term_sendkeys(buf, ":set number\<CR>")
5dba398584fd patch 9.0.0718: extra empty line between two virtual text "below"
Bram Moolenaar <Bram@vim.org>
parents: 30763
diff changeset
3060 call VerifyScreenDump(buf, 'Test_prop_with_text_after_below_trunc_2', {})
5dba398584fd patch 9.0.0718: extra empty line between two virtual text "below"
Bram Moolenaar <Bram@vim.org>
parents: 30763
diff changeset
3061
31221
59de2172e99d patch 9.0.0944: 'cursorline' causes virtual text highlight to continue
Bram Moolenaar <Bram@vim.org>
parents: 31142
diff changeset
3062 call term_sendkeys(buf, ":set cursorline\<CR>gg")
59de2172e99d patch 9.0.0944: 'cursorline' causes virtual text highlight to continue
Bram Moolenaar <Bram@vim.org>
parents: 31142
diff changeset
3063 call VerifyScreenDump(buf, 'Test_prop_with_text_after_below_trunc_3', {})
59de2172e99d patch 9.0.0944: 'cursorline' causes virtual text highlight to continue
Bram Moolenaar <Bram@vim.org>
parents: 31142
diff changeset
3064
29633
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3065 call StopVimInTerminal(buf)
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3066 endfunc
e80174903fdf patch 9.0.0157: 'showbreak' displayed below truncated "after" text prop
Bram Moolenaar <Bram@vim.org>
parents: 29629
diff changeset
3067
31257
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3068 func Test_prop_with_text_below_after_empty()
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3069 CheckRunVimInTerminal
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3070
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3071 let lines =<< trim END
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3072 vim9script
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31788
diff changeset
3073
31257
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3074 setline(1, ['vim9script', '', 'three', ''])
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3075
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3076 # Add text prop below empty line 2 with padding.
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3077 prop_type_add('test', {highlight: 'ErrorMsg'})
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3078 prop_add(2, 0, {
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3079 type: 'test',
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3080 text: 'The quick brown fox jumps over the lazy dog',
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3081 text_align: 'below',
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3082 text_padding_left: 1,
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3083 })
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3084
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3085 # Add text prop below empty line 4 without padding.
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3086 prop_type_add('other', {highlight: 'DiffChange'})
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3087 prop_add(4, 0, {
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3088 type: 'other',
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3089 text: 'The slow fox bumps into the lazy dog',
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3090 text_align: 'below',
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3091 text_padding_left: 0,
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3092 })
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3093 END
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3094 call writefile(lines, 'XscriptPropBelowAfterEmpty', 'D')
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3095 let buf = RunVimInTerminal('-S XscriptPropBelowAfterEmpty', #{rows: 8, cols: 60})
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31788
diff changeset
3096 call VerifyScreenDump(buf, 'Test_prop_below_after_empty_1', {})
31257
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3097
31283
0db9f6400e71 patch 9.0.0975: virtual text below empty line misplaced when 'number' set
Bram Moolenaar <Bram@vim.org>
parents: 31257
diff changeset
3098 call term_sendkeys(buf, ":set number\<CR>")
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31788
diff changeset
3099 call VerifyScreenDump(buf, 'Test_prop_below_after_empty_2', {})
31283
0db9f6400e71 patch 9.0.0975: virtual text below empty line misplaced when 'number' set
Bram Moolenaar <Bram@vim.org>
parents: 31257
diff changeset
3100
31323
a93392e93a53 patch 9.0.0995: padding before virtual text is highlighted
Bram Moolenaar <Bram@vim.org>
parents: 31319
diff changeset
3101 call term_sendkeys(buf, ":set nowrap\<CR>")
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31788
diff changeset
3102 call VerifyScreenDump(buf, 'Test_prop_below_after_empty_3', {})
31323
a93392e93a53 patch 9.0.0995: padding before virtual text is highlighted
Bram Moolenaar <Bram@vim.org>
parents: 31319
diff changeset
3103
31257
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3104 call StopVimInTerminal(buf)
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3105 endfunc
6ebd92646276 patch 9.0.0962: virtual text below cannot be placed below empty lines
Bram Moolenaar <Bram@vim.org>
parents: 31221
diff changeset
3106
31938
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3107 func Test_prop_with_text_above_below_empty()
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3108 CheckRunVimInTerminal
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3109
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3110 let lines =<< trim END
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3111 setlocal number
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3112 call setline(1, ['11111111', '', '333333333', '', '55555555555'])
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3113
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3114 let vt = 'test'
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3115 call prop_type_add(vt, {'highlight': 'ToDo'})
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3116 for ln in range(1, line('$'))
34441
84a5cafeb34c patch 9.1.0140: cursor on wrong row after 1 char 'below' virtual text when EOL is shown
Christian Brabandt <cb@256bit.org>
parents: 34397
diff changeset
3117 " use 1 character text to test for off-by-one regressions
84a5cafeb34c patch 9.1.0140: cursor on wrong row after 1 char 'below' virtual text when EOL is shown
Christian Brabandt <cb@256bit.org>
parents: 34397
diff changeset
3118 call prop_add(ln, 0, {'type': vt, 'text': '-', 'text_align': 'above'})
84a5cafeb34c patch 9.1.0140: cursor on wrong row after 1 char 'below' virtual text when EOL is shown
Christian Brabandt <cb@256bit.org>
parents: 34397
diff changeset
3119 call prop_add(ln, 0, {'type': vt, 'text': '+', 'text_align': 'below'})
31938
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3120 endfor
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3121 normal G
34593
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3122
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3123 func AddMore()
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3124 call prop_add(5, 0, {'type': g:vt, 'text': '!', 'text_align': 'above'})
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3125 call prop_add(5, 0, {'type': g:vt, 'text': '!', 'text_align': 'above'})
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3126 call prop_add(5, 0, {'type': g:vt, 'text': '!', 'text_align': 'above'})
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3127 endfunc
31938
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3128 END
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3129 call writefile(lines, 'XscriptPropAboveBelowEmpty', 'D')
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3130 let buf = RunVimInTerminal('-S XscriptPropAboveBelowEmpty', #{rows: 16, cols: 60})
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3131 call VerifyScreenDump(buf, 'Test_prop_above_below_empty_1', {})
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3132
31944
87ed5e064db2 patch 9.0.1304: "$" for 'list' option displayed in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31938
diff changeset
3133 call term_sendkeys(buf, ":set list\<CR>")
87ed5e064db2 patch 9.0.1304: "$" for 'list' option displayed in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31938
diff changeset
3134 call VerifyScreenDump(buf, 'Test_prop_above_below_empty_2', {})
87ed5e064db2 patch 9.0.1304: "$" for 'list' option displayed in wrong position
Bram Moolenaar <Bram@vim.org>
parents: 31938
diff changeset
3135
31986
e0e1ba7daaf4 patch 9.0.1325: 'colorcolumn' highlight wrong with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31948
diff changeset
3136 call term_sendkeys(buf, ":set nolist\<CR>")
e0e1ba7daaf4 patch 9.0.1325: 'colorcolumn' highlight wrong with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31948
diff changeset
3137 call term_sendkeys(buf, ":set colorcolumn=10\<CR>")
e0e1ba7daaf4 patch 9.0.1325: 'colorcolumn' highlight wrong with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31948
diff changeset
3138 call term_sendkeys(buf, ":\<CR>")
e0e1ba7daaf4 patch 9.0.1325: 'colorcolumn' highlight wrong with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31948
diff changeset
3139 call VerifyScreenDump(buf, 'Test_prop_above_below_empty_3', {})
e0e1ba7daaf4 patch 9.0.1325: 'colorcolumn' highlight wrong with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31948
diff changeset
3140
31988
a7801ecf7df9 patch 9.0.1326: relative line number not updated with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31986
diff changeset
3141 call term_sendkeys(buf, ":set colorcolumn=\<CR>")
a7801ecf7df9 patch 9.0.1326: relative line number not updated with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31986
diff changeset
3142 call term_sendkeys(buf, ":set relativenumber\<CR>")
a7801ecf7df9 patch 9.0.1326: relative line number not updated with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31986
diff changeset
3143 call term_sendkeys(buf, ":\<CR>")
a7801ecf7df9 patch 9.0.1326: relative line number not updated with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31986
diff changeset
3144 call VerifyScreenDump(buf, 'Test_prop_above_below_empty_4', {})
a7801ecf7df9 patch 9.0.1326: relative line number not updated with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31986
diff changeset
3145
a7801ecf7df9 patch 9.0.1326: relative line number not updated with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31986
diff changeset
3146 call term_sendkeys(buf, "kk")
a7801ecf7df9 patch 9.0.1326: relative line number not updated with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31986
diff changeset
3147 call VerifyScreenDump(buf, 'Test_prop_above_below_empty_5', {})
a7801ecf7df9 patch 9.0.1326: relative line number not updated with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 31986
diff changeset
3148
34593
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3149 " This was drawing line number over cmdline and leaking memory.
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3150 call term_sendkeys(buf, ":call AddMore()\<CR>")
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3151 call term_sendkeys(buf, "gg")
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3152 call term_sendkeys(buf, "j")
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3153 call VerifyScreenDump(buf, 'Test_prop_above_below_empty_6', {})
cb36b351c2de patch 9.1.0189: Memory leak with "above" virttext and 'relativenumber'
Christian Brabandt <cb@256bit.org>
parents: 34574
diff changeset
3154
31938
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3155 call StopVimInTerminal(buf)
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3156 endfunc
96d6d31dd66b patch 9.0.1301: virtual text below empty line not displayed
Bram Moolenaar <Bram@vim.org>
parents: 31849
diff changeset
3157
31990
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3158 func Test_prop_with_multibyte_below()
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3159 CheckRunVimInTerminal
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3160
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3161 let lines =<< trim END
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3162 setlocal number
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3163 call setline(1, ['©', '©', '©'])
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3164
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3165 let vt = 'test'
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3166 call prop_type_add(vt, {'highlight': 'ToDo'})
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3167 for ln in range(1, line('$'))
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3168 call prop_add(ln, 0, {'type': vt, 'text': '+++', 'text_align': 'below'})
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3169 endfor
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3170 normal G
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3171 END
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3172 call writefile(lines, 'XscriptPropMultibyteBelow', 'D')
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3173 let buf = RunVimInTerminal('-S XscriptPropMultibyteBelow', #{rows: 10, cols: 60})
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3174 call VerifyScreenDump(buf, 'Test_prop_multibyte_below_1', {})
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3175
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3176 call StopVimInTerminal(buf)
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3177 endfunc
27ab829631df patch 9.0.1327: cursor in wrong position below line with virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31988
diff changeset
3178
33248
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3179 func Test_prop_with_text_below_rightleft()
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3180 CheckRunVimInTerminal
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3181 CheckFeature rightleft
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3182
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3183 let lines =<< trim END
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3184 setlocal number rightleft
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3185 call setline(1, 'abcde')
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3186 call prop_type_add('theprop', #{highlight: 'Special'})
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3187 call prop_add(1, 0, #{type: 'theprop', text: '12345', text_align: 'below'})
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3188 END
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3189 call writefile(lines, 'XscriptPropBelowRightleft', 'D')
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3190 let buf = RunVimInTerminal('-S XscriptPropBelowRightleft', #{rows: 6, cols: 60})
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3191 call VerifyScreenDump(buf, 'Test_prop_below_rightleft_1', {})
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3192
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3193 call StopVimInTerminal(buf)
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3194 endfunc
0bb496f81ab2 patch 9.0.1896: "below" virtual text doesn't work with 'rightleft'
Christian Brabandt <cb@256bit.org>
parents: 33220
diff changeset
3195
31948
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3196 func Test_prop_with_text_above_empty()
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3197 CheckRunVimInTerminal
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3198
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3199 " check the cursor is in the correct line
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3200 let lines =<< trim END
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3201 setlocal number
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3202 call setline(1, ['11111111', '', '333333333', '', '55555555555'])
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3203
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3204 let vt = 'test'
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3205 call prop_type_add(vt, {'highlight': 'ToDo'})
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3206 for ln in range(1, line('$'))
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3207 call prop_add(ln, 0, {'type': vt, 'text': '---', 'text_align': 'above'})
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3208 endfor
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3209 normal G
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3210 END
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3211 call writefile(lines, 'XscriptPropAboveEmpty', 'D')
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3212 let buf = RunVimInTerminal('-S XscriptPropAboveEmpty', #{rows: 16, cols: 60})
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3213 call VerifyScreenDump(buf, 'Test_prop_above_empty_1', {})
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3214
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3215 call term_sendkeys(buf, ":set list\<CR>")
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3216 call VerifyScreenDump(buf, 'Test_prop_above_empty_2', {})
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3217
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3218 call StopVimInTerminal(buf)
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3219 endfunc
c8cfdbe7b7f2 patch 9.0.1306: no regression test for solved problem of #11959
Bram Moolenaar <Bram@vim.org>
parents: 31944
diff changeset
3220
31113
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3221 func Test_prop_with_text_below_after_match()
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3222 CheckRunVimInTerminal
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3223
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3224 let lines =<< trim END
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3225 vim9script
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3226
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3227 setline(1, ['vim9script', 'some text'])
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3228 set signcolumn=yes
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3229 matchaddpos('Search', [[1, 10]])
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3230 prop_type_add('test', {highlight: 'Error'})
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3231 prop_add(1, 0, {
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3232 type: 'test',
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3233 text: 'The quick brown fox',
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3234 text_align: 'below'
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3235 })
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3236 END
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3237 call writefile(lines, 'XscriptPropsBelow', 'D')
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3238 let buf = RunVimInTerminal('-S XscriptPropsBelow', #{rows: 8, cols: 60})
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3239 call VerifyScreenDump(buf, 'Test_prop_with_text_below_after_match_1', {})
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3240
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3241 call StopVimInTerminal(buf)
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3242 endfunc
6ff733178f8b patch 9.0.0891: virtual text below after match has wrong highlight
Bram Moolenaar <Bram@vim.org>
parents: 31071
diff changeset
3243
29585
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3244 func Test_props_with_text_after_joined()
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3245 CheckRunVimInTerminal
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3246
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3247 let lines =<< trim END
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3248 call setline(1, ['one', 'two', 'three', 'four'])
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3249 call prop_type_add('afterprop', #{highlight: 'Search'})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3250 call prop_add(1, 0, #{type: 'afterprop', text: ' ONE', text_align: 'after'})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3251 call prop_add(4, 0, #{type: 'afterprop', text: ' FOUR', text_align: 'after'})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3252 normal ggJ
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3253 normal GkJ
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3254
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3255 call setline(3, ['a', 'b', 'c', 'd', 'e', 'f'])
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3256 call prop_add(3, 0, #{type: 'afterprop', text: ' AAA', text_align: 'after'})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3257 call prop_add(5, 0, #{type: 'afterprop', text: ' CCC', text_align: 'after'})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3258 call prop_add(7, 0, #{type: 'afterprop', text: ' EEE', text_align: 'after'})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3259 call prop_add(8, 0, #{type: 'afterprop', text: ' FFF', text_align: 'after'})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3260 normal 3G6J
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3261 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3262 call writefile(lines, 'XscriptPropsWithTextAfterJoined', 'D')
29585
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3263 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterJoined', #{rows: 6, cols: 60})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3264 call VerifyScreenDump(buf, 'Test_prop_with_text_after_joined_1', {})
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3265
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3266 call StopVimInTerminal(buf)
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3267 endfunc
e357bc89bb95 patch 9.0.0133: virtual text after line moves to joined line
Bram Moolenaar <Bram@vim.org>
parents: 29583
diff changeset
3268
29597
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3269 func Test_props_with_text_after_truncated()
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3270 CheckRunVimInTerminal
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3271
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3272 let lines =<< trim END
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3273 call setline(1, ['one two three four five six seven'])
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3274 call prop_type_add('afterprop', #{highlight: 'Search'})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3275 call prop_add(1, 0, #{type: 'afterprop', text: ' ONE and TWO and THREE and FOUR and FIVE'})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3276
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3277 call setline(2, ['one two three four five six seven'])
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3278 call prop_add(2, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five', text_align: 'right'})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3279
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3280 call setline(3, ['one two three four five six seven'])
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3281 call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below'})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3282
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3283 call setline(4, ['cursor here'])
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3284 normal 4Gfh
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3285 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3286 call writefile(lines, 'XscriptPropsWithTextAfterTrunc', 'D')
29597
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3287 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterTrunc', #{rows: 9, cols: 60})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3288 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_1', {})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3289
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3290 call term_sendkeys(buf, ":37vsp\<CR>gg")
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3291 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_2', {})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3292
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3293 call term_sendkeys(buf, ":36wincmd |\<CR>")
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3294 call term_sendkeys(buf, "2G$")
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3295 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_3', {})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3296
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3297 call term_sendkeys(buf, ":33wincmd |\<CR>")
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3298 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_4', {})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3299
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3300 call term_sendkeys(buf, ":18wincmd |\<CR>")
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3301 call term_sendkeys(buf, "0fx")
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3302 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_5', {})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3303
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3304 call StopVimInTerminal(buf)
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3305 endfunc
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3306
32264
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3307 func Test_props_with_text_after_truncated_and_ambiwidth_is_double()
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3308 CheckRunVimInTerminal
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3309
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3310 let lines =<< trim END
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3311 set ambiwidth=double
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3312 call setline(1, ['one two three four five six seven'])
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3313 call prop_type_add('afterprop', #{highlight: 'Search'})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3314 call prop_add(1, 0, #{type: 'afterprop', text: ' ONE and TWO and THREE and FOUR and FIVE'})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3315
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3316 call setline(2, ['one two three four five six seven'])
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3317 call prop_add(2, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five', text_align: 'right'})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3318
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3319 call setline(3, ['one two three four five six seven'])
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3320 call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below'})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3321
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3322 call setline(4, ['cursor here'])
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3323 normal 4Gfh
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3324 END
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3325 call writefile(lines, 'XscriptPropsWithTextAfterTrunc-and-ambiwidth-is-double', 'D')
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3326 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterTrunc-and-ambiwidth-is-double', #{rows: 9, cols: 60})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3327 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_ambiw_d_1', {})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3328
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3329 call StopVimInTerminal(buf)
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3330 endfunc
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3331
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3332
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3333 func Test_props_with_text_after_truncated_not_utf8()
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3334 CheckRunVimInTerminal
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3335
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3336 let lines =<< trim END
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3337 set enc=cp932 tenc=utf-8
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3338 call setline(1, ['one two three four five six seven'])
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3339 call prop_type_add('afterprop', #{highlight: 'Search'})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3340 call prop_add(1, 0, #{type: 'afterprop', text: ' ONE and TWO and THREE and FOUR and FIVE'})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3341
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3342 call setline(2, ['one two three four five six seven'])
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3343 call prop_add(2, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five', text_align: 'right'})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3344
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3345 call setline(3, ['one two three four five six seven'])
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3346 call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below'})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3347
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3348 call setline(4, ['cursor here'])
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3349 normal 4Gfh
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3350 END
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3351 call writefile(lines, 'XscriptPropsWithTextAfterTrunc-enc-is-not-utf8', 'D')
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3352 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterTrunc-enc-is-not-utf8', #{rows: 9, cols: 60})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3353 call VerifyScreenDump(buf, 'Test_prop_with_text_after_trunc_not_utf8', {})
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3354
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3355 call StopVimInTerminal(buf)
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3356 endfunc
0df66713766e patch 9.0.1463: virtual text truncation only works with Unicode 'encoding'
Bram Moolenaar <Bram@vim.org>
parents: 32244
diff changeset
3357
29678
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3358 func Test_props_with_text_empty_line()
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3359 CheckRunVimInTerminal
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3360
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3361 let lines =<< trim END
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3362 call setline(1, ['', 'aaa', '', 'bbbbbb'])
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3363 call prop_type_add('prop1', #{highlight: 'Search'})
33138
22a29cc413c5 patch 9.0.1851: breakindent missing by virt text
Christian Brabandt <cb@256bit.org>
parents: 33103
diff changeset
3364 call prop_add(1, 1, #{type: 'prop1', text: repeat('X', &columns)})
22a29cc413c5 patch 9.0.1851: breakindent missing by virt text
Christian Brabandt <cb@256bit.org>
parents: 33103
diff changeset
3365 call prop_add(3, 1, #{type: 'prop1', text: repeat('X', &columns + 1)})
29678
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3366 normal gg0
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3367 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3368 call writefile(lines, 'XscriptPropsWithTextEmptyLine', 'D')
29678
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3369 let buf = RunVimInTerminal('-S XscriptPropsWithTextEmptyLine', #{rows: 8, cols: 60})
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3370 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_1', {})
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3371 call term_sendkeys(buf, "$")
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3372 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_2', {})
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3373 call term_sendkeys(buf, "j")
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3374 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_3', {})
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3375 call term_sendkeys(buf, "j")
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3376 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_4', {})
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3377 call term_sendkeys(buf, "j")
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3378 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_5', {})
33021
2b47322be0d1 patch 9.0.1802: Multiline regex with Visual selection fails with virtual text
Christian Brabandt <cb@256bit.org>
parents: 33017
diff changeset
3379 call term_sendkeys(buf, "0\<C-V>2l2k")
2b47322be0d1 patch 9.0.1802: Multiline regex with Visual selection fails with virtual text
Christian Brabandt <cb@256bit.org>
parents: 33017
diff changeset
3380 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_6', {})
2b47322be0d1 patch 9.0.1802: Multiline regex with Visual selection fails with virtual text
Christian Brabandt <cb@256bit.org>
parents: 33017
diff changeset
3381 call term_sendkeys(buf, "\<Esc>/aaa\\n\\%V\<CR>")
2b47322be0d1 patch 9.0.1802: Multiline regex with Visual selection fails with virtual text
Christian Brabandt <cb@256bit.org>
parents: 33017
diff changeset
3382 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_7', {})
2b47322be0d1 patch 9.0.1802: Multiline regex with Visual selection fails with virtual text
Christian Brabandt <cb@256bit.org>
parents: 33017
diff changeset
3383 call term_sendkeys(buf, "3ggic")
2b47322be0d1 patch 9.0.1802: Multiline regex with Visual selection fails with virtual text
Christian Brabandt <cb@256bit.org>
parents: 33017
diff changeset
3384 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_8', {})
2b47322be0d1 patch 9.0.1802: Multiline regex with Visual selection fails with virtual text
Christian Brabandt <cb@256bit.org>
parents: 33017
diff changeset
3385 call term_sendkeys(buf, "\<Esc>/aaa\\nc\\%V\<CR>")
2b47322be0d1 patch 9.0.1802: Multiline regex with Visual selection fails with virtual text
Christian Brabandt <cb@256bit.org>
parents: 33017
diff changeset
3386 call VerifyScreenDump(buf, 'Test_prop_with_text_empty_line_9', {})
29678
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3387
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3388 call StopVimInTerminal(buf)
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3389 endfunc
fc0f93590fd4 patch 9.0.0179: cursor pos wrong with wrapping virtual text in empty line
Bram Moolenaar <Bram@vim.org>
parents: 29676
diff changeset
3390
29597
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3391 func Test_props_with_text_after_wraps()
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3392 CheckRunVimInTerminal
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3393
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3394 let lines =<< trim END
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3395 call setline(1, ['one two three four five six seven'])
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3396 call prop_type_add('afterprop', #{highlight: 'Search'})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3397 call prop_add(1, 0, #{type: 'afterprop', text: ' ONE and TWO and THREE and FOUR and FIVE', text_wrap: 'wrap'})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3398
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3399 call setline(2, ['one two three four five six seven'])
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3400 call prop_add(2, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five', text_align: 'right', text_wrap: 'wrap'})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3401
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3402 call setline(3, ['one two three four five six seven'])
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3403 call prop_add(3, 0, #{type: 'afterprop', text: ' one AND two AND three AND four AND five lets wrap after some more text', text_align: 'below', text_wrap: 'wrap'})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3404
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3405 call setline(4, ['cursor here'])
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3406 normal 4Gfh
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3407 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3408 call writefile(lines, 'XscriptPropsWithTextAfterWraps', 'D')
29597
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3409 let buf = RunVimInTerminal('-S XscriptPropsWithTextAfterWraps', #{rows: 9, cols: 60})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3410 call VerifyScreenDump(buf, 'Test_prop_with_text_after_wraps_1', {})
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3411
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3412 call StopVimInTerminal(buf)
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3413 endfunc
f2d7f20d83c3 patch 9.0.0139: truncating virtual text after a line not implemented
Bram Moolenaar <Bram@vim.org>
parents: 29587
diff changeset
3414
29621
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3415 func Test_props_with_text_after_nowrap()
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3416 CheckRunVimInTerminal
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3417
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3418 let lines =<< trim END
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3419 set nowrap
29720
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3420 call setline(1, ['one', 'two', 'three', 'four'])
29621
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3421 call prop_type_add('belowprop', #{highlight: 'ErrorMsg'})
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3422 call prop_type_add('anotherprop', #{highlight: 'Search'})
29629
2f5610696bcd patch 9.0.0155 Problem: No test for what patch 9.0.0155 fixes. Solution: Add a test. Fix typos. (closes #10822)
Bram Moolenaar <Bram@vim.org>
parents: 29627
diff changeset
3423 call prop_type_add('someprop', #{highlight: 'DiffChange'})
29621
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3424 call prop_add(1, 0, #{type: 'belowprop', text: ' Below the line ', text_align: 'below'})
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3425 call prop_add(2, 0, #{type: 'anotherprop', text: 'another', text_align: 'below'})
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3426 call prop_add(2, 0, #{type: 'belowprop', text: 'One More Here', text_align: 'below'})
29629
2f5610696bcd patch 9.0.0155 Problem: No test for what patch 9.0.0155 fixes. Solution: Add a test. Fix typos. (closes #10822)
Bram Moolenaar <Bram@vim.org>
parents: 29627
diff changeset
3427 call prop_add(1, 0, #{type: 'someprop', text: 'right here', text_align: 'right'})
2f5610696bcd patch 9.0.0155 Problem: No test for what patch 9.0.0155 fixes. Solution: Add a test. Fix typos. (closes #10822)
Bram Moolenaar <Bram@vim.org>
parents: 29627
diff changeset
3428 call prop_add(1, 0, #{type: 'someprop', text: ' After the text', text_align: 'after'})
29720
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3429 normal 3G$
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3430
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3431 call prop_add(3, 0, #{type: 'anotherprop', text: 'right aligned', text_align: 'right'})
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3432 call prop_add(3, 0, #{type: 'anotherprop', text: 'also right aligned', text_align: 'right'})
29722
f88671dbe88b patch 9.0.0201: CursorLine highlight overrules virtual text highlight
Bram Moolenaar <Bram@vim.org>
parents: 29720
diff changeset
3433 hi CursorLine ctermbg=lightgrey
29621
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3434 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3435 call writefile(lines, 'XscriptPropsAfterNowrap', 'D')
29720
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3436 let buf = RunVimInTerminal('-S XscriptPropsAfterNowrap', #{rows: 12, cols: 60})
29621
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3437 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_1', {})
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3438
29722
f88671dbe88b patch 9.0.0201: CursorLine highlight overrules virtual text highlight
Bram Moolenaar <Bram@vim.org>
parents: 29720
diff changeset
3439 call term_sendkeys(buf, ":set signcolumn=yes foldcolumn=3 cursorline\<CR>")
29625
78418bd45852 patch 9.0.0153: no fold and sign column for virtual text with "below" align
Bram Moolenaar <Bram@vim.org>
parents: 29621
diff changeset
3440 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_2', {})
78418bd45852 patch 9.0.0153: no fold and sign column for virtual text with "below" align
Bram Moolenaar <Bram@vim.org>
parents: 29621
diff changeset
3441
29720
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3442 call term_sendkeys(buf, "j")
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3443 call VerifyScreenDump(buf, 'Test_prop_with_text_after_nowrap_3', {})
bf965640744d patch 9.0.0200: cursor wrong if 'nowrap' and two right aligned text props
Bram Moolenaar <Bram@vim.org>
parents: 29718
diff changeset
3444
29621
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3445 call StopVimInTerminal(buf)
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3446 endfunc
f1ed6f520d09 patch 9.0.0151: a "below" aligned text property does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 29615
diff changeset
3447
31297
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3448 func Test_prop_with_text_below_cul()
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3449 CheckRunVimInTerminal
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3450
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3451 let lines =<< trim END
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3452 vim9script
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3453
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3454 setline(1, ['some text', 'last line'])
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3455 set cursorline nowrap
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3456 prop_type_add('test', {highlight: 'DiffChange'})
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3457 prop_add(1, 0, {
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3458 type: 'test',
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3459 text: 'The quick brown fox jumps over the lazy dog',
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3460 text_align: 'below',
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3461 text_padding_left: 4,
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3462 })
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3463 END
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3464 call writefile(lines, 'XscriptPropsBelowCurline', 'D')
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3465 let buf = RunVimInTerminal('-S XscriptPropsBelowCurline', #{rows: 6, cols: 60})
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3466 call VerifyScreenDump(buf, 'Test_prop_with_text_below_cul_1', {})
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3467
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3468 call StopVimInTerminal(buf)
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3469 endfunc
d7a532c4d18d patch 9.0.0982: 'cursorline' not drawn before virtual text below
Bram Moolenaar <Bram@vim.org>
parents: 31283
diff changeset
3470
29635
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3471 func Test_props_with_text_below_nowrap()
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3472 CheckRunVimInTerminal
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3473
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3474 let lines =<< trim END
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3475 vim9script
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3476 edit foobar
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3477 set nowrap
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3478 set showbreak=+++\
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3479 setline(1, ['onasdf asdf asdf sdf df asdf asdf e asdf asdf asdf asdf asd fas df', 'two'])
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3480 prop_type_add('test', {highlight: 'Special'})
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3481 prop_add(1, 0, {
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3482 type: 'test',
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3483 text: 'the quick brown fox jumps over the lazy dog',
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3484 text_align: 'after'
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3485 })
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3486 prop_add(1, 0, {
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3487 type: 'test',
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3488 text: 'the quick brown fox jumps over the lazy dog',
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3489 text_align: 'below'
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3490 })
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3491 normal G$
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3492 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3493 call writefile(lines, 'XscriptPropsBelowNowrap', 'D')
29635
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3494 let buf = RunVimInTerminal('-S XscriptPropsBelowNowrap', #{rows: 8, cols: 60})
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3495 call VerifyScreenDump(buf, 'Test_prop_with_text_below_nowrap_1', {})
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3496
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3497 call term_sendkeys(buf, "gg$")
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3498 call VerifyScreenDump(buf, 'Test_prop_with_text_below_nowrap_2', {})
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3499
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3500 call StopVimInTerminal(buf)
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3501 endfunc
592818fd3110 patch 9.0.0158: with 'nowrap' "below" property not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 29633
diff changeset
3502
30205
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3503 func Test_props_with_text_above()
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3504 CheckRunVimInTerminal
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3505
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3506 let lines =<< trim END
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3507 call setline(1, ['one two', 'three four', 'five six'])
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3508 call prop_type_add('above1', #{highlight: 'Search'})
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3509 call prop_type_add('above2', #{highlight: 'DiffChange'})
30233
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3510 call prop_type_add('below', #{highlight: 'DiffAdd'})
30205
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3511 call prop_add(1, 0, #{type: 'above1', text: 'first thing above', text_align: 'above'})
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3512 call prop_add(1, 0, #{type: 'above2', text: 'second thing above', text_align: 'above'})
30213
4fedacdad3b4 patch 9.0.0442: virtual text "above" doesn't handel line numbers
Bram Moolenaar <Bram@vim.org>
parents: 30207
diff changeset
3513 call prop_add(3, 0, #{type: 'above1', text: 'another thing', text_align: 'above', text_padding_left: 3})
30205
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3514
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3515 normal gglllj
30233
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3516 func AddPropBelow()
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3517 call prop_add(1, 0, #{type: 'below', text: 'below', text_align: 'below'})
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3518 endfunc
30773
fc9993c5835a patch 9.0.0721: virtual text "above" with padding not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30767
diff changeset
3519 func AddLongPropAbove()
fc9993c5835a patch 9.0.0721: virtual text "above" with padding not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30767
diff changeset
3520 3,4delete
fc9993c5835a patch 9.0.0721: virtual text "above" with padding not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30767
diff changeset
3521 set wrap
fc9993c5835a patch 9.0.0721: virtual text "above" with padding not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30767
diff changeset
3522 call prop_add(1, 0, #{type: 'above1', text: range(50)->join(' '), text_align: 'above', text_padding_left: 2})
fc9993c5835a patch 9.0.0721: virtual text "above" with padding not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30767
diff changeset
3523 endfunc
30205
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3524 END
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3525 call writefile(lines, 'XscriptPropsWithTextAbove', 'D')
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3526 let buf = RunVimInTerminal('-S XscriptPropsWithTextAbove', #{rows: 9, cols: 60})
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3527 call VerifyScreenDump(buf, 'Test_prop_with_text_above_1', {})
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3528
30293
914b3c64ab92 patch 9.0.0482: "g0" moves to wrong location with virtual text "above"
Bram Moolenaar <Bram@vim.org>
parents: 30273
diff changeset
3529 call term_sendkeys(buf, "ggg$")
914b3c64ab92 patch 9.0.0482: "g0" moves to wrong location with virtual text "above"
Bram Moolenaar <Bram@vim.org>
parents: 30273
diff changeset
3530 call VerifyScreenDump(buf, 'Test_prop_with_text_above_1a', {})
914b3c64ab92 patch 9.0.0482: "g0" moves to wrong location with virtual text "above"
Bram Moolenaar <Bram@vim.org>
parents: 30273
diff changeset
3531 call term_sendkeys(buf, "g0")
914b3c64ab92 patch 9.0.0482: "g0" moves to wrong location with virtual text "above"
Bram Moolenaar <Bram@vim.org>
parents: 30273
diff changeset
3532 call VerifyScreenDump(buf, 'Test_prop_with_text_above_1b', {})
914b3c64ab92 patch 9.0.0482: "g0" moves to wrong location with virtual text "above"
Bram Moolenaar <Bram@vim.org>
parents: 30273
diff changeset
3533
30304
f1fe59179180 patch 9.0.0488: cursor wrong with virtual text "above" and 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 30293
diff changeset
3534 call term_sendkeys(buf, ":set showbreak=>>\<CR>")
f1fe59179180 patch 9.0.0488: cursor wrong with virtual text "above" and 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 30293
diff changeset
3535 call term_sendkeys(buf, "ggll")
f1fe59179180 patch 9.0.0488: cursor wrong with virtual text "above" and 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 30293
diff changeset
3536 call VerifyScreenDump(buf, 'Test_prop_with_text_above_1c', {})
f1fe59179180 patch 9.0.0488: cursor wrong with virtual text "above" and 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 30293
diff changeset
3537 call term_sendkeys(buf, ":set showbreak=\<CR>")
f1fe59179180 patch 9.0.0488: cursor wrong with virtual text "above" and 'showbreak'
Bram Moolenaar <Bram@vim.org>
parents: 30293
diff changeset
3538
30207
7147c6059e80 patch 9.0.0439: cursor wrong if inserting before line with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 30205
diff changeset
3539 call term_sendkeys(buf, "ggI")
7147c6059e80 patch 9.0.0439: cursor wrong if inserting before line with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 30205
diff changeset
3540 call VerifyScreenDump(buf, 'Test_prop_with_text_above_2', {})
7147c6059e80 patch 9.0.0439: cursor wrong if inserting before line with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 30205
diff changeset
3541 call term_sendkeys(buf, "inserted \<Esc>")
7147c6059e80 patch 9.0.0439: cursor wrong if inserting before line with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 30205
diff changeset
3542 call VerifyScreenDump(buf, 'Test_prop_with_text_above_3', {})
7147c6059e80 patch 9.0.0439: cursor wrong if inserting before line with virtual text above
Bram Moolenaar <Bram@vim.org>
parents: 30205
diff changeset
3543
30213
4fedacdad3b4 patch 9.0.0442: virtual text "above" doesn't handel line numbers
Bram Moolenaar <Bram@vim.org>
parents: 30207
diff changeset
3544 call term_sendkeys(buf, ":set number signcolumn=yes\<CR>")
4fedacdad3b4 patch 9.0.0442: virtual text "above" doesn't handel line numbers
Bram Moolenaar <Bram@vim.org>
parents: 30207
diff changeset
3545 call VerifyScreenDump(buf, 'Test_prop_with_text_above_4', {})
4fedacdad3b4 patch 9.0.0442: virtual text "above" doesn't handel line numbers
Bram Moolenaar <Bram@vim.org>
parents: 30207
diff changeset
3546
30231
0d084880276a patch 9.0.0451: virtual text "above" does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30213
diff changeset
3547 call term_sendkeys(buf, ":set nowrap\<CR>gg$j")
0d084880276a patch 9.0.0451: virtual text "above" does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30213
diff changeset
3548 call VerifyScreenDump(buf, 'Test_prop_with_text_above_5', {})
0d084880276a patch 9.0.0451: virtual text "above" does not work with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30213
diff changeset
3549
30233
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3550 call term_sendkeys(buf, ":call AddPropBelow()\<CR>")
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3551 call term_sendkeys(buf, "ggve")
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3552 call VerifyScreenDump(buf, 'Test_prop_with_text_above_6', {})
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3553 call term_sendkeys(buf, "V")
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3554 call VerifyScreenDump(buf, 'Test_prop_with_text_above_7', {})
8d660a45299f patch 9.0.0452: Visual highlighting extends into virtual text prop
Bram Moolenaar <Bram@vim.org>
parents: 30231
diff changeset
3555
30245
8f85b5c45432 patch 9.0.0458: splitting a line with a text prop "above" moves it down
Bram Moolenaar <Bram@vim.org>
parents: 30233
diff changeset
3556 call term_sendkeys(buf, "\<Esc>ls\<CR>\<Esc>")
8f85b5c45432 patch 9.0.0458: splitting a line with a text prop "above" moves it down
Bram Moolenaar <Bram@vim.org>
parents: 30233
diff changeset
3557 call VerifyScreenDump(buf, 'Test_prop_with_text_above_8', {})
8f85b5c45432 patch 9.0.0458: splitting a line with a text prop "above" moves it down
Bram Moolenaar <Bram@vim.org>
parents: 30233
diff changeset
3558
30773
fc9993c5835a patch 9.0.0721: virtual text "above" with padding not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30767
diff changeset
3559 call term_sendkeys(buf, ":call AddLongPropAbove()\<CR>")
fc9993c5835a patch 9.0.0721: virtual text "above" with padding not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30767
diff changeset
3560 call VerifyScreenDump(buf, 'Test_prop_with_text_above_9', {})
fc9993c5835a patch 9.0.0721: virtual text "above" with padding not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30767
diff changeset
3561
30205
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3562 call StopVimInTerminal(buf)
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3563 endfunc
ed6f3d2593df patch 9.0.0438: cannot put virtual text above a line
Bram Moolenaar <Bram@vim.org>
parents: 30039
diff changeset
3564
32301
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3565 func Test_prop_with_text_above_padding()
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3566 CheckRunVimInTerminal
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3567
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3568 let lines =<< trim END
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3569 vim9script
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3570
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3571 setlocal tabstop=8 noexpandtab
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3572 setline(1, ['', 'sky is blue', 'ocean is blue'])
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3573 prop_type_add('DiagVirtualText', {highlight: 'Search', override: true})
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3574 prop_add(3, 0, {text: "┌─ start", text_align: "above",
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3575 type: 'DiagVirtualText',
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3576 text_padding_left: 200})
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3577 END
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3578 call writefile(lines, 'XscriptAbovePadding', 'D')
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3579 let buf = RunVimInTerminal('-S XscriptAbovePadding', #{rows: 8})
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3580 call VerifyScreenDump(buf, 'Test_prop_above_padding_1', {})
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3581
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3582 call StopVimInTerminal(buf)
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3583 endfunc
15352bf5c33e patch 9.0.1482: crash when textprop has a very large "padding" value
Bram Moolenaar <Bram@vim.org>
parents: 32264
diff changeset
3584
30257
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3585 func Test_prop_above_with_indent()
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3586 new
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3587 call setline(1, ['first line', ' second line', ' line below'])
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3588 setlocal cindent
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3589 call prop_type_add('indented', #{highlight: 'Search'})
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3590 call prop_add(3, 0, #{type: 'indented', text: 'here', text_align: 'above', text_padding_left: 4})
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3591 call assert_equal(' line below', getline(3))
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3592
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3593 exe "normal 3G2|a\<CR>"
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3594 call assert_equal(' ', getline(3))
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3595 call assert_equal(' line below', getline(4))
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3596
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3597 bwipe!
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3598 call prop_type_delete('indented')
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3599 endfunc
45788c16b3a5 patch 9.0.0464: with virtual text "above" indenting doesn't work well
Bram Moolenaar <Bram@vim.org>
parents: 30245
diff changeset
3600
30900
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3601 func Test_prop_above_with_number()
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3602 CheckRunVimInTerminal
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3603
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3604 let lines =<< trim END
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3605 vim9script
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3606 setline(1, ['one one one', 'two two two', 'three three three'])
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3607 set number cpo+=n
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3608 prop_type_add('test', {highlight: 'DiffChange'})
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3609 prop_add(2, 0, {
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3610 text: 'above the text',
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3611 type: 'test',
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3612 text_align: 'above',
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3613 })
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3614 def g:OneMore()
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3615 prop_add(2, 0, {
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3616 text: 'also above the text',
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3617 type: 'test',
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3618 text_align: 'above',
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3619 })
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3620 enddef
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3621 END
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3622 call writefile(lines, 'XscriptPropAboveNr', 'D')
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3623 let buf = RunVimInTerminal('-S XscriptPropAboveNr', #{rows: 8})
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3624 call VerifyScreenDump(buf, 'Test_prop_above_number_1', {})
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3625
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3626 call term_sendkeys(buf, ":call OneMore()\<CR>")
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3627 call VerifyScreenDump(buf, 'Test_prop_above_number_2', {})
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3628
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3629 call StopVimInTerminal(buf)
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3630 endfunc
51ffb2dedf04 patch 9.0.0784: text prop "above" not right with 'number' and "n" in 'cpo'
Bram Moolenaar <Bram@vim.org>
parents: 30813
diff changeset
3631
33103
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3632 func Test_prop_above_with_linebreak()
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3633 CheckRunVimInTerminal
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3634
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3635 let lines =<< trim END
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3636 setlocal linebreak breakindent breakindentopt=shift:4
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3637 call setline(1, ["a b", "c d"])
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3638 call prop_type_add('theprop' , #{highlight: 'Special'})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3639 call prop_add(1, 0, #{type: 'theprop', text: '123', text_align: 'above'})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3640 normal! 2gg$
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3641 END
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3642 call writefile(lines, 'XscriptPropAboveLinebreak', 'D')
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3643 let buf = RunVimInTerminal('-S XscriptPropAboveLinebreak', #{rows: 6})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3644 call VerifyScreenDump(buf, 'Test_prop_above_linebreak_1', {})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3645 call term_sendkeys(buf, 'k')
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3646 call VerifyScreenDump(buf, 'Test_prop_above_linebreak_2', {})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3647
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3648 call StopVimInTerminal(buf)
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3649 endfunc
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3650
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3651 func Test_prop_above_and_before()
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3652 CheckRunVimInTerminal
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3653
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3654 let lines =<< trim END
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3655 setlocal linebreak breakindent breakindentopt=shift:2
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3656 call setline(1, ["a", " b c"])
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3657 call prop_type_add('theprop' , #{highlight: 'Special'})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3658 call prop_add(2, 0, #{type: 'theprop', text: ' 123', text_align: 'above'})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3659 call prop_add(2, 4, #{type: 'theprop', text: ': 456'} )
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3660 normal! 2gg$
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3661 END
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3662 call writefile(lines, 'XscriptPropAboveAndBefore', 'D')
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3663 let buf = RunVimInTerminal('-S XscriptPropAboveAndBefore', #{rows: 6})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3664 call VerifyScreenDump(buf, 'Test_prop_above_and_before_1', {})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3665 call term_sendkeys(buf, 'h')
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3666 call VerifyScreenDump(buf, 'Test_prop_above_and_before_2', {})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3667 call term_sendkeys(buf, 'h')
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3668 call VerifyScreenDump(buf, 'Test_prop_above_and_before_3', {})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3669 call term_sendkeys(buf, 'h')
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3670 call VerifyScreenDump(buf, 'Test_prop_above_and_before_4', {})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3671 call term_sendkeys(buf, 'h')
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3672 call VerifyScreenDump(buf, 'Test_prop_above_and_before_5', {})
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3673
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3674 call StopVimInTerminal(buf)
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3675 endfunc
61fc08239937 patch 9.0.1836: display wrong with virttext, linebreak and breakindent
Christian Brabandt <cb@256bit.org>
parents: 33086
diff changeset
3676
30261
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3677 func Test_prop_below_split_line()
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3678 CheckRunVimInTerminal
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3679
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3680 let lines =<< trim END
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3681 vim9script
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3682 setline(1, ['one one one', 'two two two', 'three three three'])
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3683 prop_type_add('test', {highlight: 'Search'})
30261
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3684 prop_add(2, 0, {
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3685 text: '└─ Virtual text below the 2nd line',
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3686 type: 'test',
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3687 text_align: 'below',
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3688 text_padding_left: 3
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3689 })
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3690 END
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3691 call writefile(lines, 'XscriptPropBelowSpitLine', 'D')
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3692 let buf = RunVimInTerminal('-S XscriptPropBelowSpitLine', #{rows: 8})
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3693 call term_sendkeys(buf, "2GA\<CR>xx")
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3694 call VerifyScreenDump(buf, 'Test_prop_below_split_line_1', {})
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3695
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3696 call term_sendkeys(buf, "\<Esc>:set number\<CR>")
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3697 call VerifyScreenDump(buf, 'Test_prop_below_split_line_2', {})
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3698
30365
748b8dcfba57 patch 9.0.0518: virtual text highlight starts too early with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30359
diff changeset
3699 call term_sendkeys(buf, ":set nowrap\<CR>")
748b8dcfba57 patch 9.0.0518: virtual text highlight starts too early with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30359
diff changeset
3700 call VerifyScreenDump(buf, 'Test_prop_below_split_line_3', {})
748b8dcfba57 patch 9.0.0518: virtual text highlight starts too early with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30359
diff changeset
3701
30261
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3702 call StopVimInTerminal(buf)
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3703 endfunc
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3704
31371
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3705 func Test_prop_above_below_smoothscroll()
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3706 CheckRunVimInTerminal
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3707
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3708 let lines =<< trim END
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3709 vim9script
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3710 setline(1, range(1, 10)->mapnew((_, v) => '" line ' .. v))
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3711
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3712 set smoothscroll wrap
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3713 call prop_type_add('mytype', {highlight: 'DiffChange'})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3714 call prop_add(3, 0, {text: "insert above", type: "mytype", text_align: 'above'})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3715 call prop_add(5, 0, {text: "insert above 1", type: "mytype", text_align: 'above'})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3716 call prop_add(5, 0, {text: "insert above 2", type: "mytype", text_align: 'above'})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3717 call prop_add(7, 0, {text: "insert below", type: "mytype", text_align: 'below'})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3718 call prop_add(9, 0, {text: "insert below 1", type: "mytype", text_align: 'below'})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3719 call prop_add(9, 0, {text: "insert below 2", type: "mytype", text_align: 'below'})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3720 END
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3721 call writefile(lines, 'XscriptPropsSmoothscroll', 'D')
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3722 let buf = RunVimInTerminal('-S XscriptPropsSmoothscroll', #{rows: 8, cols: 60})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3723 call VerifyScreenDump(buf, 'Test_prop_above_below_smoothscroll_1', {})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3724
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3725 for nr in range(2, 16)
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3726 call term_sendkeys(buf, "\<C-E>")
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3727 call VerifyScreenDump(buf, 'Test_prop_above_below_smoothscroll_' .. nr, {})
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3728 endfor
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3729
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3730 call StopVimInTerminal(buf)
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3731 endfunc
1c43d8bad31d patch 9.0.1019: 'smoothscroll' and virtual text above don't work together
Bram Moolenaar <Bram@vim.org>
parents: 31323
diff changeset
3732
29736
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3733 func Test_props_with_text_override()
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3734 CheckRunVimInTerminal
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3735
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3736 let lines =<< trim END
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3737 vim9script
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3738 setline(1, 'some text here')
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3739 hi Likethis ctermfg=blue ctermbg=cyan
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3740 prop_type_add('prop', {highlight: 'Likethis', override: true})
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3741 prop_add(1, 6, {type: 'prop', text: ' inserted '})
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3742 hi CursorLine cterm=underline ctermbg=lightgrey
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3743 set cursorline
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3744 END
30261
6b658ef69e93 patch 9.0.0466: virtual text wrong after adding line break after line
Bram Moolenaar <Bram@vim.org>
parents: 30257
diff changeset
3745 call writefile(lines, 'XscriptPropsOverride', 'D')
29736
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3746 let buf = RunVimInTerminal('-S XscriptPropsOverride', #{rows: 6, cols: 60})
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3747 call VerifyScreenDump(buf, 'Test_prop_with_text_override_1', {})
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3748
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3749 call term_sendkeys(buf, ":set nocursorline\<CR>")
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3750 call term_sendkeys(buf, "0llvfr")
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3751 call VerifyScreenDump(buf, 'Test_prop_with_text_override_2', {})
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3752
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3753 call StopVimInTerminal(buf)
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3754 endfunc
65348cc3b656 patch 9.0.0208: the override flag has no effect for virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29730
diff changeset
3755
29708
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3756 func Test_props_with_text_CursorMoved()
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3757 CheckRunVimInTerminal
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3758
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3759 let lines =<< trim END
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3760 call setline(1, ['this is line one', 'this is line two', 'three', 'four', 'five'])
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3761
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3762 call prop_type_add('prop', #{highlight: 'Error'})
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3763 let g:long_text = repeat('x', &columns * 2)
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3764
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3765 let g:prop_id = v:null
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3766 func! Update()
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3767 if line('.') == 1
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3768 if g:prop_id == v:null
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3769 let g:prop_id = prop_add(1, 0, #{type: 'prop', text_wrap: 'wrap', text: g:long_text})
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3770 endif
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3771 elseif g:prop_id != v:null
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3772 call prop_remove(#{id: g:prop_id})
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3773 let g:prop_id = v:null
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3774 endif
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3775 endfunc
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3776
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3777 autocmd CursorMoved * call Update()
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3778 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3779 call writefile(lines, 'XscriptPropsCursorMovec', 'D')
29708
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3780 let buf = RunVimInTerminal('-S XscriptPropsCursorMovec', #{rows: 8, cols: 60})
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3781 call term_sendkeys(buf, "gg0w")
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3782 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_1', {})
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3783
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3784 call term_sendkeys(buf, "j")
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3785 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_2', {})
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3786
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3787 " back to the first state
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3788 call term_sendkeys(buf, "k")
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3789 call VerifyScreenDump(buf, 'Test_prop_with_text_cursormoved_1', {})
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3790
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3791 call StopVimInTerminal(buf)
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3792 endfunc
d97b2ce26258 patch 9.0.0194: cursor displayed in wrong position after removing text prop
Bram Moolenaar <Bram@vim.org>
parents: 29706
diff changeset
3793
29627
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3794 func Test_props_with_text_after_split_join()
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3795 CheckRunVimInTerminal
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3796
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3797 let lines =<< trim END
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3798 call setline(1, ['1122'])
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3799 call prop_type_add('belowprop', #{highlight: 'ErrorMsg'})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3800 call prop_add(1, 0, #{type: 'belowprop', text: ' Below the line ', text_align: 'below'})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3801 exe "normal f2i\<CR>\<Esc>"
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3802
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3803 func AddMore()
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3804 call prop_type_add('another', #{highlight: 'Search'})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3805 call prop_add(1, 0, #{type: 'another', text: ' after the text ', text_align: 'after'})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3806 call prop_add(1, 0, #{type: 'another', text: ' right here', text_align: 'right'})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3807 endfunc
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3808 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3809 call writefile(lines, 'XscriptPropsAfterSplitJoin', 'D')
29627
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3810 let buf = RunVimInTerminal('-S XscriptPropsAfterSplitJoin', #{rows: 8, cols: 60})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3811 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_1', {})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3812
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3813 call term_sendkeys(buf, "ggJ")
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3814 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_2', {})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3815
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3816 call term_sendkeys(buf, ":call AddMore()\<CR>")
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3817 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_3', {})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3818
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3819 call term_sendkeys(buf, "ggf s\<CR>\<Esc>")
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3820 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_4', {})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3821
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3822 call term_sendkeys(buf, "ggJ")
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3823 call VerifyScreenDump(buf, 'Test_prop_with_text_after_join_split_5', {})
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3824
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3825 call StopVimInTerminal(buf)
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3826 endfunc
dd96f3d8ed85 patch 9.0.0154: text properties wrong after splitting a line
Bram Moolenaar <Bram@vim.org>
parents: 29625
diff changeset
3827
29552
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3828 func Test_removed_prop_with_text_cleans_up_array()
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3829 new
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3830 call setline(1, 'some text here')
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3831 call prop_type_add('some', #{highlight: 'ErrorMsg'})
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3832 let id1 = prop_add(1, 5, #{type: 'some', text: "SOME"})
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3833 call assert_equal(-1, id1)
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3834 let id2 = prop_add(1, 10, #{type: 'some', text: "HERE"})
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3835 call assert_equal(-2, id2)
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3836
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3837 " removing the props resets the index
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3838 call prop_remove(#{id: id1})
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3839 call prop_remove(#{id: id2})
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3840 let id1 = prop_add(1, 5, #{type: 'some', text: "SOME"})
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3841 call assert_equal(-1, id1)
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3842
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3843 call prop_type_delete('some')
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3844 bwipe!
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3845 endfunc
89a97f70e8eb patch 9.0.0117: text of removed textprop with text is not freed
Bram Moolenaar <Bram@vim.org>
parents: 29550
diff changeset
3846
29579
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3847 def Test_insert_text_before_virtual_text()
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3848 new foobar
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3849 setline(1, '12345678')
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3850 prop_type_add('test', {highlight: 'Search'})
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3851 prop_add(1, 5, {
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3852 type: 'test',
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3853 text: ' virtual text '
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3854 })
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3855 normal! f4axyz
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3856 normal! f5iXYZ
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3857 assert_equal('1234xyzXYZ5678', getline(1))
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3858
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3859 prop_type_delete('test')
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3860 bwipe!
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3861 enddef
f7a64755dbe9 patch 9.0.0130: cursor position wrong when inserting around virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29568
diff changeset
3862
29730
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3863 func Test_insert_text_start_incl()
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3864 CheckRunVimInTerminal
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3865
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3866 let lines =<< trim END
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3867 vim9script
29748
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3868 setline(1, ['text one text two', '', 'function(arg)'])
29730
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3869
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3870 prop_type_add('propincl', {highlight: 'NonText', start_incl: true})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3871 prop_add(1, 6, {type: 'propincl', text: 'after '})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3872 cursor(1, 6)
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3873 prop_type_add('propnotincl', {highlight: 'NonText', start_incl: false})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3874 prop_add(1, 15, {type: 'propnotincl', text: 'before '})
29748
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3875
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31788
diff changeset
3876 set cindent sw=4
29748
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3877 prop_type_add('argname', {highlight: 'DiffChange', start_incl: true})
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3878 prop_add(3, 10, {type: 'argname', text: 'arg: '})
29730
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3879 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3880 call writefile(lines, 'XscriptPropsStartIncl', 'D')
29730
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3881 let buf = RunVimInTerminal('-S XscriptPropsStartIncl', #{rows: 8, cols: 60})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3882 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_1', {})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3883
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3884 call term_sendkeys(buf, "i")
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3885 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_2', {})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3886 call term_sendkeys(buf, "xx\<Esc>")
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3887 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_3', {})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3888
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3889 call term_sendkeys(buf, "2wi")
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3890 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_4', {})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3891 call term_sendkeys(buf, "yy\<Esc>")
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3892 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_5', {})
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3893
29748
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3894 call term_sendkeys(buf, "3Gfai\<CR>\<Esc>")
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3895 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_6', {})
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3896 call term_sendkeys(buf, ">>")
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3897 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_7', {})
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3898 call term_sendkeys(buf, "<<<<")
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3899 call VerifyScreenDump(buf, 'Test_prop_insert_start_incl_8', {})
7e2321707fea patch 9.0.0214: splitting a line may duplicate virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29740
diff changeset
3900
29730
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3901 call StopVimInTerminal(buf)
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3902 endfunc
0eeab24d3faf patch 9.0.0205: cursor in wrong position when inserting after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29722
diff changeset
3903
29740
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3904 func Test_insert_text_list_mode()
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3905 CheckRunVimInTerminal
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3906
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3907 let lines =<< trim END
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3908 vim9script
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3909 setline(1, ['This is a line with quite a bit of text here.',
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3910 'second line', 'third line'])
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3911 set list listchars+=extends:»
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3912 prop_type_add('Prop1', {highlight: 'Error'})
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3913 prop_add(1, 0, {
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3914 type: 'Prop1',
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3915 text: 'The quick brown fox jumps over the lazy dog',
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3916 text_align: 'right'
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3917 })
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3918 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3919 call writefile(lines, 'XscriptPropsListMode', 'D')
29740
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3920 let buf = RunVimInTerminal('-S XscriptPropsListMode', #{rows: 8, cols: 60})
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3921 call term_sendkeys(buf, "ggj")
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3922 call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_1', {})
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3923
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3924 call term_sendkeys(buf, ":set nowrap\<CR>")
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3925 call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_2', {})
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3926
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3927 call term_sendkeys(buf, "ggd32l")
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3928 call VerifyScreenDump(buf, 'Test_prop_insert_list_mode_3', {})
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3929
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3930 call StopVimInTerminal(buf)
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3931 endfunc
b167c91b5f6b patch 9.0.0210: 'list' mode does not work properly with virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29736
diff changeset
3932
29816
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3933 func Test_insert_text_with_padding()
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3934 CheckRunVimInTerminal
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3935
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3936 let lines =<< trim END
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3937 vim9script
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3938 setline(1, ['Some text to add virtual text to.',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3939 'second line',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3940 'Another line with some text to make the wrap.'])
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3941 prop_type_add('theprop', {highlight: 'DiffChange'})
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3942 prop_add(1, 0, {
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3943 type: 'theprop',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3944 text: 'after',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3945 text_align: 'after',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3946 text_padding_left: 3,
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3947 })
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3948 prop_add(1, 0, {
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3949 type: 'theprop',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3950 text: 'right aligned',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3951 text_align: 'right',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3952 text_padding_left: 5,
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3953 })
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3954 prop_add(1, 0, {
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3955 type: 'theprop',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3956 text: 'below the line',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3957 text_align: 'below',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3958 text_padding_left: 4,
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3959 })
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3960 prop_add(3, 0, {
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3961 type: 'theprop',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3962 text: 'rightmost',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3963 text_align: 'right',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3964 text_padding_left: 6,
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3965 text_wrap: 'wrap',
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3966 })
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3967 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
3968 call writefile(lines, 'XscriptPropsPadded', 'D')
29816
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3969 let buf = RunVimInTerminal('-S XscriptPropsPadded', #{rows: 8, cols: 60})
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3970 call VerifyScreenDump(buf, 'Test_prop_text_with_padding_1', {})
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3971
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3972 call term_sendkeys(buf, "ggixxxxxxxxxx\<Esc>")
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3973 call term_sendkeys(buf, "3Gix\<Esc>")
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3974 call VerifyScreenDump(buf, 'Test_prop_text_with_padding_2', {})
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3975
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3976 call term_sendkeys(buf, "ggix\<Esc>")
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3977 call VerifyScreenDump(buf, 'Test_prop_text_with_padding_3', {})
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3978
30273
5f112a0b4da1 patch 9.0.0472: virtual text "below" doesn't show in list mode
Bram Moolenaar <Bram@vim.org>
parents: 30261
diff changeset
3979 call term_sendkeys(buf, ":set list\<CR>")
5f112a0b4da1 patch 9.0.0472: virtual text "below" doesn't show in list mode
Bram Moolenaar <Bram@vim.org>
parents: 30261
diff changeset
3980 call VerifyScreenDump(buf, 'Test_prop_text_with_padding_4', {})
5f112a0b4da1 patch 9.0.0472: virtual text "below" doesn't show in list mode
Bram Moolenaar <Bram@vim.org>
parents: 30261
diff changeset
3981
29816
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3982 call StopVimInTerminal(buf)
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3983 endfunc
bbe62ea78aac patch 9.0.0247: cannot add padding to virtual text without highlight
Bram Moolenaar <Bram@vim.org>
parents: 29788
diff changeset
3984
30741
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3985 func Test_long_text_below_with_padding()
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3986 CheckRunVimInTerminal
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3987
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3988 let lines =<< trim END
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3989 vim9script
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3990 setline(1, ['first line', 'second line'])
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3991 prop_type_add('theprop', {highlight: 'DiffChange'})
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3992 prop_add(1, 0, {
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3993 type: 'theprop',
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3994 text: 'after '->repeat(20),
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3995 text_align: 'below',
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3996 text_padding_left: 3,
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3997 })
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3998 prop_add(1, 0, {
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
3999 type: 'theprop',
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4000 text: 'more '->repeat(20),
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4001 text_align: 'below',
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4002 text_padding_left: 30,
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4003 })
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4004 normal 2Gw
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4005 END
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4006 call writefile(lines, 'XlongTextBelowWithPadding', 'D')
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4007 let buf = RunVimInTerminal('-S XlongTextBelowWithPadding', #{rows: 8, cols: 60})
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4008 call VerifyScreenDump(buf, 'Test_long_text_with_padding_1', {})
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4009
30777
8f25424b4bfd patch 9.0.0723: extra empty line below virtual text when 'list' is set
Bram Moolenaar <Bram@vim.org>
parents: 30775
diff changeset
4010 call term_sendkeys(buf, ":set list\<CR>")
8f25424b4bfd patch 9.0.0723: extra empty line below virtual text when 'list' is set
Bram Moolenaar <Bram@vim.org>
parents: 30775
diff changeset
4011 call VerifyScreenDump(buf, 'Test_long_text_with_padding_2', {})
8f25424b4bfd patch 9.0.0723: extra empty line below virtual text when 'list' is set
Bram Moolenaar <Bram@vim.org>
parents: 30775
diff changeset
4012
30741
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4013 call StopVimInTerminal(buf)
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4014 endfunc
11875afe85b2 patch 9.0.0705: virtual text truncation does not take padding into account
Bram Moolenaar <Bram@vim.org>
parents: 30365
diff changeset
4015
30749
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4016 func Test_text_after_nowrap()
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4017 CheckRunVimInTerminal
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4018
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4019 let lines =<< trim END
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4020 vim9script
30763
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4021 setline(1, ['first line', range(80)->join(' '), 'third', 'fourth'])
30749
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4022 set nowrap
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4023 prop_type_add('theprop', {highlight: 'DiffChange'})
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4024 prop_add(1, 0, {
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4025 type: 'theprop',
30763
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4026 text: 'right after the text '->repeat(3),
30749
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4027 text_align: 'after',
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4028 text_padding_left: 2,
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4029 })
30763
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4030 prop_add(1, 0, {
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4031 type: 'theprop',
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4032 text: 'in the middle '->repeat(4),
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4033 text_align: 'after',
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4034 text_padding_left: 3,
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4035 })
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4036 prop_add(1, 0, {
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4037 type: 'theprop',
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4038 text: 'the last one '->repeat(3),
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4039 text_align: 'after',
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4040 text_padding_left: 1,
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4041 })
30749
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4042 normal 2Gw
30781
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4043 def g:ChangeText()
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4044 prop_clear(1)
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4045 set list
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4046 prop_add(1, 0, {
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4047 type: 'theprop',
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4048 text: 'just after txt '->repeat(3),
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4049 text_align: 'after',
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4050 text_padding_left: 2,
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4051 })
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4052 prop_add(1, 0, {
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4053 type: 'theprop',
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4054 text: 'in the middle '->repeat(4),
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4055 text_align: 'after',
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4056 text_padding_left: 1,
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4057 })
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4058 enddef
30749
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4059 END
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4060 call writefile(lines, 'XTextAfterNowrap', 'D')
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4061 let buf = RunVimInTerminal('-S XTextAfterNowrap', #{rows: 8, cols: 60})
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4062 call VerifyScreenDump(buf, 'Test_text_after_nowrap_1', {})
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4063
30763
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4064 call term_sendkeys(buf, "30w")
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4065 call VerifyScreenDump(buf, 'Test_text_after_nowrap_2', {})
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4066
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4067 call term_sendkeys(buf, "22w")
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4068 call VerifyScreenDump(buf, 'Test_text_after_nowrap_3', {})
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4069
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4070 call term_sendkeys(buf, "$")
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4071 call VerifyScreenDump(buf, 'Test_text_after_nowrap_4', {})
8ea77a6ceff0 patch 9.0.0716: with 'nowrap' virtual text "after" does not scroll left
Bram Moolenaar <Bram@vim.org>
parents: 30759
diff changeset
4072
30781
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4073 call term_sendkeys(buf, "0")
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4074 call term_sendkeys(buf, ":call ChangeText()\<CR>")
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4075 call VerifyScreenDump(buf, 'Test_text_after_nowrap_5', {})
82fd47d71971 patch 9.0.0725: virtual text "after" wraps to next line when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 30777
diff changeset
4076
30749
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4077 call StopVimInTerminal(buf)
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4078 endfunc
6fe513996997 patch 9.0.0709: virtual text "after" not correct with 'nowrap'
Bram Moolenaar <Bram@vim.org>
parents: 30741
diff changeset
4079
31142
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4080 func Test_text_after_nowrap_list()
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4081 CheckRunVimInTerminal
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4082
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4083 let lines =<< trim END
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4084 vim9script
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4085
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4086 set nowrap
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4087 set listchars+=extends:>
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4088 set list
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4089 setline(1, ['some text here', '', 'last line'])
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4090
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4091 prop_type_add('test', {highlight: 'DiffChange'})
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4092 prop_add(1, 0, {
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4093 type: 'test',
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4094 text: 'The quick brown fox jumps.',
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4095 text_padding_left: 2,
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4096 })
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4097 prop_add(1, 0, {
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4098 type: 'test',
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4099 text: '■ The fox jumps over the lazy dog.',
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4100 text_padding_left: 2,
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4101 })
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4102 prop_add(1, 0, {
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4103 type: 'test',
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4104 text: '■ The lazy dog.',
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4105 text_padding_left: 2,
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4106 })
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4107 normal 3G$
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4108 END
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4109 call writefile(lines, 'XTextAfterNowrapList', 'D')
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4110 let buf = RunVimInTerminal('-S XTextAfterNowrapList', #{rows: 6, cols: 60})
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4111 call VerifyScreenDump(buf, 'Test_text_after_nowrap_list_1', {})
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4112
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4113 call StopVimInTerminal(buf)
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4114 endfunc
7b16ac81a349 patch 9.0.0905: virtual text after the line wraps when 'wrap' is off
Bram Moolenaar <Bram@vim.org>
parents: 31119
diff changeset
4115
30759
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4116 func Test_text_below_nowrap()
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4117 CheckRunVimInTerminal
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4118
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4119 let lines =<< trim END
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4120 vim9script
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4121 setline(1, ['first line', 'second line '->repeat(50), 'third', 'fourth'])
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4122 set nowrap number
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4123 prop_type_add('theprop', {highlight: 'DiffChange'})
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4124 prop_add(1, 0, {
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4125 type: 'theprop',
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4126 text: 'one below the text '->repeat(5),
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4127 text_align: 'below',
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4128 text_padding_left: 2,
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4129 })
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4130 prop_add(1, 0, {
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4131 type: 'theprop',
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4132 text: 'two below the text '->repeat(5),
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4133 text_align: 'below',
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4134 text_padding_left: 2,
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4135 })
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4136 normal 2Gw
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4137 END
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4138 call writefile(lines, 'XTextBelowNowrap', 'D')
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4139 let buf = RunVimInTerminal('-S XTextBelowNowrap', #{rows: 8, cols: 60})
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4140 call VerifyScreenDump(buf, 'Test_text_below_nowrap_1', {})
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4141
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4142 call StopVimInTerminal(buf)
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4143 endfunc
b41ccaa6fd84 patch 9.0.0714: with 'nowrap' two virtual text below not displayed correctly
Bram Moolenaar <Bram@vim.org>
parents: 30749
diff changeset
4144
34397
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4145 func Test_virtual_text_overlap_with_highlight()
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4146 CheckRunVimInTerminal
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4147
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4148 let lines =<< trim END
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4149 vim9script
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4150 setline(1, ['one', 'two', 'three', 'four', 'five'])
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4151 set number
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4152
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4153 prop_type_add('demo_highlight_warning', {highlight: 'WarningMsg'})
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4154 prop_type_add('demo_virtual_text_error', {highlight: 'Error'})
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4155
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4156 prop_add(2, 4, {
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4157 type: 'demo_highlight_warning',
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4158 end_col: 4,
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4159 })
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4160 prop_add(2, 0, {
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4161 type: 'demo_virtual_text_error',
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4162 text: 'syntax error',
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4163 text_align: 'below',
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4164 })
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4165 normal 2j
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4166
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4167 prop_add(4, 4, {
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4168 type: 'demo_highlight_warning',
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4169 end_lnum: 5,
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4170 end_col: 1,
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4171 })
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4172 prop_add(4, 0, {
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4173 type: 'demo_virtual_text_error',
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4174 text: 'other error',
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4175 text_align: 'right',
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4176 })
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4177 END
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4178 call writefile(lines, 'XVirtualTextOverlapWithHighlight', 'D')
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4179 let buf = RunVimInTerminal('-S XVirtualTextOverlapWithHighlight', #{rows: 8, cols: 60})
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4180 call VerifyScreenDump(buf, 'Test_virtual_text_overlap_with_highlight_1', {})
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4181
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4182 call StopVimInTerminal(buf)
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4183 endfunc
f0cdbcf53264 patch 9.1.0124: display of below/right virtual text with non-virtual text overlap
Christian Brabandt <cb@256bit.org>
parents: 33872
diff changeset
4184
31119
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4185 func Test_virtual_text_in_popup_highlight()
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4186 CheckRunVimInTerminal
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4187
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4188 let lines =<< trim END
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4189 vim9script
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4190
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4191 # foreground highlight only, popup background is used
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4192 prop_type_add('Prop1', {'highlight': 'SpecialKey'})
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4193 # foreground and background highlight, popup background is not used
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4194 prop_type_add('Prop2', {'highlight': 'DiffDelete'})
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4195
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4196 var popupText = [{
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4197 text: 'Some text',
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4198 props: [
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4199 {
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4200 col: 1,
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4201 type: 'Prop1',
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4202 text: ' + '
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4203 },
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4204 {
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4205 col: 6,
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4206 type: 'Prop2',
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4207 text: ' x '
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4208 },
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4209 ]
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4210 }]
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4211 var popupArgs = {
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4212 line: 3,
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4213 col: 20,
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4214 maxwidth: 80,
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4215 highlight: 'PMenu',
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4216 border: [],
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4217 borderchars: [' '],
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4218 }
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4219
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4220 popup_create(popupText, popupArgs)
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4221 END
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4222 call writefile(lines, 'XscriptVirtualHighlight', 'D')
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4223 let buf = RunVimInTerminal('-S XscriptVirtualHighlight', #{rows: 8})
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4224 call VerifyScreenDump(buf, 'Test_virtual_text_in_popup_highlight_1', {})
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4225
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4226 call StopVimInTerminal(buf)
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4227 endfunc
e2c909e06424 patch 9.0.0894: virtual text property highlight ignores window background
Bram Moolenaar <Bram@vim.org>
parents: 31113
diff changeset
4228
29826
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4229 func Test_insert_text_change_arg()
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4230 CheckRunVimInTerminal
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4231
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4232 let lines =<< trim END
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4233 vim9script
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4234 setline(1, ['SetErrorCode( 10, 20 )', 'second line'])
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4235 prop_type_add('param', {highlight: 'DiffChange', start_incl: 1})
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4236 prop_type_add('padd', {highlight: 'NonText', start_incl: 1})
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4237 prop_add(1, 15, {
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4238 type: 'param',
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4239 text: 'id:',
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4240 })
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4241 prop_add(1, 15, {
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4242 type: 'padd',
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4243 text: '-',
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4244 })
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4245 prop_add(1, 19, {
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4246 type: 'param',
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4247 text: 'id:',
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4248 })
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4249 prop_add(1, 19, {
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4250 type: 'padd',
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4251 text: '-',
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4252 })
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4253 END
30359
6391b3ca26b7 patch 9.0.0515: virtual text highlight starts too early when 'number' is set
Bram Moolenaar <Bram@vim.org>
parents: 30306
diff changeset
4254 call writefile(lines, 'XscriptPropsChange', 'D')
29826
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4255 let buf = RunVimInTerminal('-S XscriptPropsChange', #{rows: 5, cols: 60})
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4256 call VerifyScreenDump(buf, 'Test_prop_text_change_arg_1', {})
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4257
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4258 call term_sendkeys(buf, "ggf1cw1234\<Esc>")
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4259 call VerifyScreenDump(buf, 'Test_prop_text_change_arg_2', {})
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4260
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4261 call StopVimInTerminal(buf)
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4262 endfunc
bfd08e50e2c0 patch 9.0.0252: cursor in wrong place after virtual text
Bram Moolenaar <Bram@vim.org>
parents: 29816
diff changeset
4263
31071
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4264 def Test_textprop_in_quickfix_window()
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4265 enew!
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4266 var prop_type = 'my_prop'
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4267 prop_type_add(prop_type, {})
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4268
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4269 for lnum in range(1, 10)
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4270 setline(lnum, 'hello world')
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4271 endfor
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4272
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4273 cgetbuffer
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4274 copen
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4275
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4276 var bufnr = bufnr()
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4277 for lnum in range(1, line('$', bufnr->bufwinid()))
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4278 prop_add(lnum, 1, {
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4279 id: 1000 + lnum,
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4280 type: prop_type,
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4281 bufnr: bufnr,
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4282 })
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4283 endfor
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4284
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4285 prop_type_delete(prop_type)
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4286 cclose
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4287 bwipe!
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4288 enddef
7678a5c9334a patch 9.0.0870: get E967 when using text property in quickfix window
Bram Moolenaar <Bram@vim.org>
parents: 30986
diff changeset
4289
31319
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4290 func Test_text_prop_delete_updates()
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4291 CheckRunVimInTerminal
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4292
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4293 let lines =<< trim END
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4294 vim9script
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4295
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4296 setline(1, ['some text', 'more text', 'the end'])
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4297 prop_type_add('test', {highlight: 'DiffChange'})
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4298 prop_add(1, 0, {
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4299 type: 'test',
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4300 text: 'The quick brown fox jumps over the lazy dog',
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4301 text_align: 'below',
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4302 text_padding_left: 3,
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4303 })
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4304 prop_add(1, 0, {
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4305 type: 'test',
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4306 text: 'The quick brown fox jumps over the lazy dog',
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4307 text_align: 'below',
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4308 text_padding_left: 5,
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4309 })
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4310
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4311 normal! G
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4312 END
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4313 call writefile(lines, 'XtextPropDelete', 'D')
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4314 let buf = RunVimInTerminal('-S XtextPropDelete', #{rows: 10, cols: 60})
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4315 call VerifyScreenDump(buf, 'Test_prop_delete_updates_1', {})
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4316
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4317 " Check that after deleting the text prop type the text properties using
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4318 " this type no longer show and are not counted for cursor positioning.
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4319 call term_sendkeys(buf, ":call prop_type_delete('test')\<CR>")
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4320 call VerifyScreenDump(buf, 'Test_prop_delete_updates_2', {})
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4321
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4322 call term_sendkeys(buf, "ggj")
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4323 call VerifyScreenDump(buf, 'Test_prop_delete_updates_3', {})
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4324
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4325 call StopVimInTerminal(buf)
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4326 endfunc
243c35fad9cb patch 9.0.0993: display errors when adding or removing text property type
Bram Moolenaar <Bram@vim.org>
parents: 31297
diff changeset
4327
31469
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4328 func Test_text_prop_diff_mode()
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4329 CheckRunVimInTerminal
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4330
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4331 let lines =<< trim END
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4332 call setline(1, ['9000', '0009', '0009', '9000', '0009'])
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4333
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4334 let type = 'test'
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4335 call prop_type_add(type, {})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4336 let text = '<text>'
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4337 call prop_add(1, 1, {'type': type, 'text': text})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4338 call prop_add(2, 0, {'type': type, 'text': text, 'text_align': 'after'})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4339 call prop_add(3, 0, {'type': type, 'text': text, 'text_align': 'right'})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4340 call prop_add(4, 0, {'type': type, 'text': text, 'text_align': 'above'})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4341 call prop_add(5, 0, {'type': type, 'text': text, 'text_align': 'below'})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4342 set diff
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4343
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4344 vnew
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4345 call setline(1, ['000', '000', '000', '000', '000'])
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4346 set diff
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4347 END
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4348 call writefile(lines, 'XtextPropDiff', 'D')
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4349 let buf = RunVimInTerminal('-S XtextPropDiff', #{rows: 10, cols: 60})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4350 call VerifyScreenDump(buf, 'Test_prop_diff_mode_1', {})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4351
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4352 call term_sendkeys(buf, ":windo set number\<CR>")
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4353 call VerifyScreenDump(buf, 'Test_prop_diff_mode_2', {})
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4354
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4355 call StopVimInTerminal(buf)
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4356 endfunc
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 31788
diff changeset
4357
31489
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4358 func Test_error_when_using_negative_id()
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4359 call prop_type_add('test1', #{highlight: 'ErrorMsg'})
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4360 call prop_add(1, 1, #{type: 'test1', text: 'virtual'})
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4361 call assert_fails("call prop_add(1, 1, #{type: 'test1', length: 1, id: -1})", 'E1293:')
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4362
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4363 call prop_type_delete('test1')
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4364 endfunc
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4365
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4366 func Test_error_after_using_negative_id()
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4367 " This needs to run a separate Vim instance because the
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4368 " "did_use_negative_pop_id" will be set.
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4369 CheckRunVimInTerminal
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4370
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4371 let lines =<< trim END
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4372 vim9script
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4373
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4374 setline(1, ['one', 'two', 'three'])
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4375 prop_type_add('test_1', {highlight: 'Error'})
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4376 prop_type_add('test_2', {highlight: 'WildMenu'})
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4377
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4378 prop_add(3, 1, {
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4379 type: 'test_1',
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4380 length: 5,
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4381 id: -1
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4382 })
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4383
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4384 def g:AddTextprop()
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4385 prop_add(1, 0, {
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4386 type: 'test_2',
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4387 text: 'The quick fox',
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4388 text_padding_left: 2
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4389 })
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4390 enddef
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4391 END
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4392 call writefile(lines, 'XtextPropError', 'D')
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4393 let buf = RunVimInTerminal('-S XtextPropError', #{rows: 8, cols: 60})
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4394 call VerifyScreenDump(buf, 'Test_prop_negative_error_1', {})
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4395
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4396 call term_sendkeys(buf, ":call AddTextprop()\<CR>")
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4397 call VerifyScreenDump(buf, 'Test_prop_negative_error_2', {})
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4398
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4399 call StopVimInTerminal(buf)
966c87c57912 patch 9.0.1077: can add text property with negative ID before virtual text
Bram Moolenaar <Bram@vim.org>
parents: 31469
diff changeset
4400 endfunc
31469
c097c18dcedb patch 9.0.1067: in diff mode virtual text is highlighted incorrectly
Bram Moolenaar <Bram@vim.org>
parents: 31371
diff changeset
4401
32925
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4402 func Test_modify_text_before_prop()
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4403 CheckRunVimInTerminal
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4404
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4405 let lines =<< trim END
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4406 vim9script
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4407 setline(1, ['test_words', 'second line', 'third line', 'fourth line'])
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4408 set number
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4409 prop_type_add('text', {highlight: 'DiffChange'})
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4410 prop_type_add('below', {highlight: 'NonText'})
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4411 prop_add(1, 11, {type: 'text', text: repeat('a', 65)})
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4412 prop_add(1, 0, {type: 'below', text: repeat('a', 65), text_align: 'below'})
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4413 END
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4414 call writefile(lines, 'XtextPropModifyBefore', 'D')
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4415 let buf = RunVimInTerminal('-S XtextPropModifyBefore', #{rows: 5, cols: 60})
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4416 call VerifyScreenDump(buf, 'Test_modify_text_before_prop_1', {})
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4417
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4418 call term_sendkeys(buf, "xxia\<Esc>")
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4419 call VerifyScreenDump(buf, 'Test_modify_text_before_prop_2', {})
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4420
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4421 call StopVimInTerminal(buf)
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4422 endfunc
5d17e74a756d patch 9.0.1770: lines disappear when modifying chars before virt text
Christian Brabandt <cb@256bit.org>
parents: 32907
diff changeset
4423
32752
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4424 func Test_overlong_textprop_above_crash()
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4425 CheckRunVimInTerminal
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4426
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4427 let lines =<< trim END
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4428 vim9script
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4429 prop_type_add('PropType', {highlight: 'Error'})
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4430 setline(1, ['xxx ', 'yyy'])
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4431 prop_add(1, 0, {
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4432 type: 'PropType',
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4433 text: 'the quick brown fox jumps over the lazy dog. the quick brown fox jumps over the lazy dog. the quick brown fox jumps over the lazy dog.',
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4434 text_align: 'above',
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4435 text_wrap: 'wrap',
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4436 })
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4437 END
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4438 call writefile(lines, 'XtextPropLongAbove', 'D')
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4439 let buf = RunVimInTerminal('-S XtextPropLongAbove', #{rows: 8, cols: 60})
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4440 call VerifyScreenDump(buf, 'Test_prop_long_above_1', {})
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4441
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4442 call StopVimInTerminal(buf)
f1fdbcd46f3a patch 9.0.1695: Crash with overlong textprop above
Christian Brabandt <cb@256bit.org>
parents: 32301
diff changeset
4443 endfunc
32881
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4444
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4445 func Test_text_prop_list_hl_and_sign_highlight()
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4446 CheckRunVimInTerminal
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4447
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4448 let lines =<< trim END
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4449 func Test()
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4450 split Xbuffer
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4451 call setline(1, ['one', "\ttab", ' space', 'three', 'four', 'five'])
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4452 call prop_type_add('Prop1', #{highlight: 'Search', override: v:true})
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4453 sign define sign1 text=>> linehl=DiffAdd
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4454 sign place 10 line=2 name=sign1
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4455 sign place 20 line=3 name=sign1
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4456 call prop_add(1, 1, #{end_lnum: 4, end_col: 5, type: 'Prop1'})
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4457 sign place 30 line=5 name=sign1
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4458 endfunc
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4459 call Test()
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4460 END
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4461 call writefile(lines, 'XtextPropSignTab', 'D')
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4462 let buf = RunVimInTerminal('-S XtextPropSignTab', #{rows: 8, cols: 60})
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4463 call VerifyScreenDump(buf, 'Test_prop_sign_tab_1', {})
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4464
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4465 call term_sendkeys(buf, ":setl list listchars=eol:¶,tab:>-\<CR>")
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4466 call VerifyScreenDump(buf, 'Test_prop_sign_tab_2', {})
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4467
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4468 call StopVimInTerminal(buf)
ec310fcd2d12 patch 9.0.1749: Text property highlight doesn't override a sign highlight on TAB
Christian Brabandt <cb@256bit.org>
parents: 32872
diff changeset
4469 endfunc
32907
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4470
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4471 " Test for getting the virtual text properties
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4472 func Test_virtual_text_get()
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4473 new foobar
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4474 call setline(1, '12345678')
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4475 call prop_type_add('test', #{highlight: 'Search'})
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4476 call prop_add(1, 2, #{type: 'test', text: ' virtual text1 '})
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4477 call prop_add(1, 3, #{type: 'test'})
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4478 call prop_add(1, 0, #{type: 'test', text: ' virtual text2 ',
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4479 \ text_align: 'right'})
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4480 call prop_add(1, 5, #{type: 'test'})
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4481 call prop_add(1, 6, #{type: 'test', text: ' virtual text3 ',
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4482 \ text_wrap: 'wrap'})
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4483
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4484 let p = prop_list(1, #{end_lnum: -1})
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4485 call assert_equal(
32964
c7a332a34fe7 patch 9.0.1782: prop_list() does not return text_padding_left
Christian Brabandt <cb@256bit.org>
parents: 32925
diff changeset
4486 \ #{lnum: 1, col: 2, type_bufnr: 0, end: 1,
c7a332a34fe7 patch 9.0.1782: prop_list() does not return text_padding_left
Christian Brabandt <cb@256bit.org>
parents: 32925
diff changeset
4487 \ type: 'test', start: 1,
32907
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4488 \ text: ' virtual text1 '}, p[0])
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4489 call assert_equal(
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4490 \ #{lnum: 1, id: 0, col: 3, type_bufnr: 0, end: 1,
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4491 \ type: 'test', length: 0, start: 1}, p[1])
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4492 call assert_equal(
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4493 \ #{lnum: 1, id: 0, col: 5, type_bufnr: 0, end: 1,
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4494 \ type: 'test', length: 0, start: 1}, p[2])
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4495 call assert_equal(
32964
c7a332a34fe7 patch 9.0.1782: prop_list() does not return text_padding_left
Christian Brabandt <cb@256bit.org>
parents: 32925
diff changeset
4496 \ #{lnum: 1, col: 6, type_bufnr: 0, end: 1, type: 'test',
c7a332a34fe7 patch 9.0.1782: prop_list() does not return text_padding_left
Christian Brabandt <cb@256bit.org>
parents: 32925
diff changeset
4497 \ text_wrap: 'wrap', start: 1, text: ' virtual text3 '},
32907
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4498 \ p[3])
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4499 call assert_equal('right', p[4].text_align)
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4500
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4501 call prop_type_delete('test')
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4502 bwipe!
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4503 endfunc
98db7b3b4827 patch 9.0.1762: Not able to get the virtual text property
Christian Brabandt <cb@256bit.org>
parents: 32881
diff changeset
4504
33872
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4505 " This used to throw: E967
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4506 func Test_textprop_notype_join()
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4507 new Xtextprop_no_type_join
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4508 call setline(1, range(1, 3))
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4509 call cursor(1, 1)
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4510 let name = 'a'
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4511 call prop_type_add(name, {})
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4512 call prop_add(line('.'), col('.'), { 'type': name })
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4513 call prop_type_delete(name, {})
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4514 join
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4515 call assert_equal(["1 2", "3"], getline(1, '$'))
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4516
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4517 bwipe!
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4518 endfunc
2c5ae1ce5af2 patch 9.0.2146: text-property without type errors when joining
Christian Brabandt <cb@256bit.org>
parents: 33868
diff changeset
4519
34493
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4520 " This was causing text property corruption.
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4521 func Test_textprop_backspace_fo_aw()
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4522 new
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4523 call setline(1, 'foobar')
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4524 call prop_type_add('test', {'highlight': 'ErrorMsg'})
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4525 call prop_add(1, 1, {'type': 'test', 'length': 3})
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4526 set backspace=indent,eol,start
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4527 setlocal formatoptions+=aw
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4528 call feedkeys("A \<CR>\<BS>\<Esc>", 'tx')
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4529 call assert_equal('foobar', getline(1))
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4530 call assert_equal([
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4531 \ #{id: 0, col: 1, start: 1, end: 1, type_bufnr: 0,
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4532 \ type: 'test', length: 3}], prop_list(1))
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4533
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4534 bwipe!
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4535 set backspace&
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4536 call prop_type_delete('test')
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4537 endfunc
1fa23ccd6d9a patch 9.1.0153: Text properties corrupted with fo+=aw and backspace
Christian Brabandt <cb@256bit.org>
parents: 34441
diff changeset
4538
34557
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4539 func Test_textprop_with_wincolor()
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4540 CheckRunVimInTerminal
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4541
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4542 let lines =<< trim END
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4543 call setline(1, 'some text here')
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4544 call setline(2, 'some much longer text here')
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4545 call setline(3, 'more text here')
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4546 call prop_type_add('afterprop', #{highlight: 'Search'})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4547 call prop_type_add('belowprop', #{highlight: 'DiffAdd'})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4548 call prop_add(3, 0, #{type: 'afterprop', text: 'AFTER',
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4549 \ text_align: 'after', text_padding_left: 3})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4550 call prop_add(1, 0, #{type: 'belowprop', text: 'BELOW',
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4551 \ text_align: 'below', text_padding_left: 3})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4552 set wincolor=DiffChange wrap
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4553 END
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4554 call writefile(lines, 'XtextPropWincolor', 'D')
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4555 let buf = RunVimInTerminal('-S XtextPropWincolor', #{rows: 8, cols: 60})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4556
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4557 call term_sendkeys(buf, ":\<CR>")
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4558 call VerifyScreenDump(buf, 'Test_prop_wincolor_1', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4559
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4560 call term_sendkeys(buf, ":set cursorline\<CR>:\<CR>")
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4561 call VerifyScreenDump(buf, 'Test_prop_wincolor_2', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4562
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4563 call term_sendkeys(buf, ":set nowrap\<CR>:\<CR>")
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4564 call VerifyScreenDump(buf, 'Test_prop_wincolor_2', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4565
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4566 call term_sendkeys(buf, ":set nocursorline\<CR>:\<CR>")
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4567 call VerifyScreenDump(buf, 'Test_prop_wincolor_1', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4568
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4569 call term_sendkeys(buf, ":set cursorline colorcolumn=30\<CR>:\<CR>")
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4570 call VerifyScreenDump(buf, 'Test_prop_wincolor_3', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4571
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4572 call term_sendkeys(buf, ":hi CursorLine ctermbg=Brown\<CR>:\<CR>")
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4573 call VerifyScreenDump(buf, 'Test_prop_wincolor_4', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4574
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4575 call term_sendkeys(buf, ":set cursorcolumn\<CR>:\<CR>")
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4576 call term_sendkeys(buf, '$')
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4577 call VerifyScreenDump(buf, 'Test_prop_wincolor_5', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4578
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4579 call term_sendkeys(buf, 'j')
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4580 call VerifyScreenDump(buf, 'Test_prop_wincolor_6', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4581
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4582 call term_sendkeys(buf, ":set virtualedit=all\<CR>:\<CR>")
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4583 call term_sendkeys(buf, 'l')
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4584 call VerifyScreenDump(buf, 'Test_prop_wincolor_7', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4585
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4586 call term_sendkeys(buf, 'k')
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4587 call VerifyScreenDump(buf, 'Test_prop_wincolor_8', {})
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4588
34574
74baeec0f24f patch 9.1.0185: 'wincolor' hl missing with 'rightleft', "below" virttext, 'nowrap'
Christian Brabandt <cb@256bit.org>
parents: 34557
diff changeset
4589 if has('rightleft')
74baeec0f24f patch 9.1.0185: 'wincolor' hl missing with 'rightleft', "below" virttext, 'nowrap'
Christian Brabandt <cb@256bit.org>
parents: 34557
diff changeset
4590 call term_sendkeys(buf, ":set rightleft\<CR>:\<CR>")
74baeec0f24f patch 9.1.0185: 'wincolor' hl missing with 'rightleft', "below" virttext, 'nowrap'
Christian Brabandt <cb@256bit.org>
parents: 34557
diff changeset
4591 call VerifyScreenDump(buf, 'Test_prop_wincolor_9', {})
74baeec0f24f patch 9.1.0185: 'wincolor' hl missing with 'rightleft', "below" virttext, 'nowrap'
Christian Brabandt <cb@256bit.org>
parents: 34557
diff changeset
4592 endif
74baeec0f24f patch 9.1.0185: 'wincolor' hl missing with 'rightleft', "below" virttext, 'nowrap'
Christian Brabandt <cb@256bit.org>
parents: 34557
diff changeset
4593
34557
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4594 call StopVimInTerminal(buf)
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4595 endfunc
28dab9103dd5 patch 9.1.0179: 'wincolor' highlight missing with "below" virtual text
Christian Brabandt <cb@256bit.org>
parents: 34493
diff changeset
4596
20178
2fb397573541 patch 8.2.0644: insufficient testing for invalid function arguments
Bram Moolenaar <Bram@vim.org>
parents: 19642
diff changeset
4597 " vim: shiftwidth=2 sts=2 expandtab