diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-05-30 15:32:02 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-05-30 15:32:02 +0200 |
commit | 87be9be1db6b6d8fb57ef14e05f23a84e5e8bea0 (patch) | |
tree | f48a2f1809c3ce3f589b34fbebd219a4d21bc5fd /src/testdir/test_textprop.vim | |
parent | a9d4b84d97fb74061eeb42c1433e111fb58825dc (diff) | |
download | vim-git-87be9be1db6b6d8fb57ef14e05f23a84e5e8bea0.tar.gz |
patch 8.2.0845: text properties crossing lines not handled correctlyv8.2.0845
Problem: Text properties crossing lines not handled correctly.
Solution: When joining lines merge text properties if possible.
(Axel Forsman, closes #5839, closes #5683)
Diffstat (limited to 'src/testdir/test_textprop.vim')
-rw-r--r-- | src/testdir/test_textprop.vim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index f91597ff5..5dddd1691 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -460,9 +460,11 @@ func Test_prop_open_line() call assert_equal('nex xtwoxx', getline(2)) let exp_first = [deepcopy(expected[0])] let exp_first[0].length = 1 + let exp_first[0].end = 0 call assert_equal(exp_first, prop_list(1)) let expected[0].col = 1 let expected[0].length = 2 + let expected[0].start = 0 let expected[1].col -= 2 call assert_equal(expected, prop_list(2)) call DeletePropTypes() @@ -575,11 +577,13 @@ func Test_prop_substitute() \ copy(expected_props[3]), \ ] let expected_props[0].length = 5 + let expected_props[0].end = 0 unlet expected_props[3] unlet expected_props[2] call assert_equal(expected_props, prop_list(1)) let new_props[0].length = 6 + let new_props[0].start = 0 let new_props[1].col = 1 let new_props[1].length = 1 let new_props[2].col = 3 @@ -1228,4 +1232,25 @@ func Test_prop_func_invalid_args() call assert_fails("call prop_type_list([])", 'E715:') endfunc +func Test_split_join() + new + call prop_type_add('test', {'highlight': 'ErrorMsg'}) + call setline(1, 'just some text') + call prop_add(1, 6, {'length': 4, 'type': 'test'}) + + " Split in middle of "some" + execute "normal! 8|i\<CR>" + call assert_equal([{'id': 0, 'col': 6, 'end': 0, 'type': 'test', 'length': 2, 'start': 1}], + \ prop_list(1)) + call assert_equal([{'id': 0, 'col': 1, 'end': 1, 'type': 'test', 'length': 2, 'start': 0}], + \ prop_list(2)) + + " Join the two lines back together + normal! 1GJ + call assert_equal([{'id': 0, 'col': 6, 'end': 1, 'type': 'test', 'length': 5, 'start': 1}], prop_list(1)) + + bwipe! + call prop_type_delete('test') +endfunc + " vim: shiftwidth=2 sts=2 expandtab |