comparison 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
comparison
equal deleted inserted replaced
22277:4575b886c258 22278:0416105e103b
1271 call assert_fails("call prop_type_get([])", 'E730:') 1271 call assert_fails("call prop_type_get([])", 'E730:')
1272 call assert_fails("call prop_type_get('', [])", 'E474:') 1272 call assert_fails("call prop_type_get('', [])", 'E474:')
1273 call assert_fails("call prop_type_list([])", 'E715:') 1273 call assert_fails("call prop_type_list([])", 'E715:')
1274 endfunc 1274 endfunc
1275 1275
1276 func Test_split_join() 1276 func Test_prop_split_join()
1277 new 1277 new
1278 call prop_type_add('test', {'highlight': 'ErrorMsg'}) 1278 call prop_type_add('test', {'highlight': 'ErrorMsg'})
1279 call setline(1, 'just some text') 1279 call setline(1, 'just some text')
1280 call prop_add(1, 6, {'length': 4, 'type': 'test'}) 1280 call prop_add(1, 6, {'length': 4, 'type': 'test'})
1281 1281
1292 1292
1293 bwipe! 1293 bwipe!
1294 call prop_type_delete('test') 1294 call prop_type_delete('test')
1295 endfunc 1295 endfunc
1296 1296
1297 func Test_prop_increment_decrement()
1298 new
1299 call prop_type_add('test', {'highlight': 'ErrorMsg'})
1300 call setline(1, 'its 998 times')
1301 call prop_add(1, 5, {'length': 3, 'type': 'test'})
1302
1303 exe "normal! 0f9\<C-A>"
1304 eval getline(1)->assert_equal('its 999 times')
1305 eval prop_list(1)->assert_equal([
1306 \ #{id: 0, col: 5, end: 1, type: 'test', length: 3, start: 1}])
1307
1308 exe "normal! 0f9\<C-A>"
1309 eval getline(1)->assert_equal('its 1000 times')
1310 eval prop_list(1)->assert_equal([
1311 \ #{id: 0, col: 5, end: 1, type: 'test', length: 4, start: 1}])
1312
1313 bwipe!
1314 call prop_type_delete('test')
1315 endfunc
1316
1297 " vim: shiftwidth=2 sts=2 expandtab 1317 " vim: shiftwidth=2 sts=2 expandtab