@@ -1314,4 +1314,35 @@ func Test_prop_increment_decrement()
13141314 call prop_type_delete (' test' )
13151315endfunc
13161316
1317+ func Test_prop_block_insert ()
1318+ new
1319+ call prop_type_add (' test' , {' highlight' : ' ErrorMsg' })
1320+ call setline (1 , [' one ' , ' two ' ])
1321+ call prop_add (1 , 1 , {' length' : 3 , ' type' : ' test' })
1322+ call prop_add (2 , 1 , {' length' : 3 , ' type' : ' test' })
1323+
1324+ " insert "xx" in the first column of both lines
1325+ exe " normal! gg0\<C-V> jIxx\<Esc> "
1326+ eval getline (1 , 2 )- >assert_equal ([' xxone ' , ' xxtwo ' ])
1327+ let expected = [#{id: 0 , col : 3 , end : 1 , type : ' test' , length: 3 , start : 1 }]
1328+ eval prop_list (1 )- >assert_equal (expected)
1329+ eval prop_list (2 )- >assert_equal (expected)
1330+
1331+ " insert "yy" inside the text props to make them longer
1332+ exe " normal! gg03l\<C-V> jIyy\<Esc> "
1333+ eval getline (1 , 2 )- >assert_equal ([' xxoyyne ' , ' xxtyywo ' ])
1334+ let expected[0 ].length = 5
1335+ eval prop_list (1 )- >assert_equal (expected)
1336+ eval prop_list (2 )- >assert_equal (expected)
1337+
1338+ " insert "zz" after the text props, text props don't change
1339+ exe " normal! gg07l\<C-V> jIzz\<Esc> "
1340+ eval getline (1 , 2 )- >assert_equal ([' xxoyynezz ' , ' xxtyywozz ' ])
1341+ eval prop_list (1 )- >assert_equal (expected)
1342+ eval prop_list (2 )- >assert_equal (expected)
1343+
1344+ bwipe!
1345+ call prop_type_delete (' test' )
1346+ endfunc
1347+
13171348" vim: shiftwidth = 2 sts = 2 expandtab
0 commit comments