patch 9.0.0117: text of removed textprop with text is not freed
Problem: Text of removed textprop with text is not freed.
Solution: Free the text when the property is removed. Reduce the array size
to ignore NULLs at the end.
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 5a3f9b3..a3a3c00 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2213,4 +2213,23 @@
call delete('XscriptPropsWithText')
endfunc
+func Test_removed_prop_with_text_cleans_up_array()
+ new
+ call setline(1, 'some text here')
+ call prop_type_add('some', #{highlight: 'ErrorMsg'})
+ let id1 = prop_add(1, 5, #{type: 'some', text: "SOME"})
+ call assert_equal(-1, id1)
+ let id2 = prop_add(1, 10, #{type: 'some', text: "HERE"})
+ call assert_equal(-2, id2)
+
+ " removing the props resets the index
+ call prop_remove(#{id: id1})
+ call prop_remove(#{id: id2})
+ let id1 = prop_add(1, 5, #{type: 'some', text: "SOME"})
+ call assert_equal(-1, id1)
+
+ call prop_type_delete('some')
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab