patch 8.2.1688: increment/decrement removes text property
Problem: Increment/decrement removes text property.
Solution: Insert the new number before deleting the old one. (closes #6962)
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index ff7102f..ae84cf9 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -1273,7 +1273,7 @@
call assert_fails("call prop_type_list([])", 'E715:')
endfunc
-func Test_split_join()
+func Test_prop_split_join()
new
call prop_type_add('test', {'highlight': 'ErrorMsg'})
call setline(1, 'just some text')
@@ -1294,4 +1294,24 @@
call prop_type_delete('test')
endfunc
+func Test_prop_increment_decrement()
+ new
+ call prop_type_add('test', {'highlight': 'ErrorMsg'})
+ call setline(1, 'its 998 times')
+ call prop_add(1, 5, {'length': 3, 'type': 'test'})
+
+ exe "normal! 0f9\<C-A>"
+ eval getline(1)->assert_equal('its 999 times')
+ eval prop_list(1)->assert_equal([
+ \ #{id: 0, col: 5, end: 1, type: 'test', length: 3, start: 1}])
+
+ exe "normal! 0f9\<C-A>"
+ eval getline(1)->assert_equal('its 1000 times')
+ eval prop_list(1)->assert_equal([
+ \ #{id: 0, col: 5, end: 1, type: 'test', length: 4, start: 1}])
+
+ bwipe!
+ call prop_type_delete('test')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab