patch 8.2.0324: text property not updated correctly when inserting/deleting
Problem: Text property not updated correctly when inserting/deleting.
Solution: Use the right column when deleting. Make zero-width text
properties respect start_incl and end_incl. (Axel Forsman,
closes #5696, closes #5679)
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 32001b3..6dbaa53 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -6,8 +6,6 @@
source screendump.vim
-" test length zero
-
func Test_proptype_global()
call prop_type_add('comment', {'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
let proptypes = prop_type_list()
@@ -233,13 +231,20 @@
" Prop without length or end column is zero length
call prop_clear(1)
- call prop_add(1, 5, {'type': 'two'})
- let expected = [{'col': 5, 'length': 0, 'type': 'two', 'id': 0, 'start': 1, 'end': 1}]
+ call prop_type_add('included', {'start_incl': 1, 'end_incl': 1})
+ call prop_add(1, 5, #{type: 'included'})
+ let expected = [#{col: 5, length: 0, type: 'included', id: 0, start: 1, end: 1}]
+ call assert_equal(expected, prop_list(1))
+
+ " Inserting text makes the prop bigger.
+ exe "normal 5|ixx\<Esc>"
+ let expected = [#{col: 5, length: 2, type: 'included', id: 0, start: 1, end: 1}]
call assert_equal(expected, prop_list(1))
call assert_fails("call prop_add(1, 5, {'type': 'two', 'bufnr': 234343})", 'E158:')
call DeletePropTypes()
+ call prop_type_delete('included')
bwipe!
endfunc