diff src/testdir/test_textprop.vim @ 22278:0416105e103b v8.2.1688

patch 8.2.1688: increment/decrement removes text property Commit: https://github.com/vim/vim/commit/c8f12c9856df58c760fe54d81b2ec5ed4dcaffd6 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 15 20:34:10 2020 +0200 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 https://github.com/vim/vim/issues/6962)
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Sep 2020 20:45:03 +0200
parents d55008685870
children 5adb97bf0b32
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -1273,7 +1273,7 @@ func Test_prop_func_invalid_args()
   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 @@ func Test_split_join()
   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