@@ -650,6 +650,35 @@ func Test_prop_undo()
650650 call prop_type_delete (' comment' )
651651endfunc
652652
653+ func Test_prop_delete_text ()
654+ new
655+ call prop_type_add (' comment' , {' highlight' : ' Directory' })
656+ call setline (1 , [' oneone' , ' twotwo' , ' three' ])
657+
658+ " zero length property
659+ call prop_add (1 , 3 , {' type' : ' comment' })
660+ let expected = [{' col' : 3 , ' length' : 0 , ' id' : 0 , ' type' : ' comment' , ' start' : 1 , ' end' : 1 } ]
661+ call assert_equal (expected, prop_list (1 ))
662+
663+ " delete one char moves the property
664+ normal ! x
665+ let expected = [{' col' : 2 , ' length' : 0 , ' id' : 0 , ' type' : ' comment' , ' start' : 1 , ' end' : 1 } ]
666+ call assert_equal (expected, prop_list (1 ))
667+
668+ " delete char of the property has no effect
669+ normal ! lx
670+ let expected = [{' col' : 2 , ' length' : 0 , ' id' : 0 , ' type' : ' comment' , ' start' : 1 , ' end' : 1 } ]
671+ call assert_equal (expected, prop_list (1 ))
672+
673+ " delete more chars moves property to first column, is not deleted
674+ normal ! 0 xxxx
675+ let expected = [{' col' : 1 , ' length' : 0 , ' id' : 0 , ' type' : ' comment' , ' start' : 1 , ' end' : 1 } ]
676+ call assert_equal (expected, prop_list (1 ))
677+
678+ bwipe!
679+ call prop_type_delete (' comment' )
680+ endfunc
681+
653682" screenshot test with textprop highlighting
654683func Test_textprop_screenshot_various ()
655684 CheckScreendump
0 commit comments