Mercurial > vim
diff src/testdir/test_textprop.vim @ 15292:ba6f0f1bb9d0 v8.1.0654
patch 8.1.0654: when deleting a line text property flags are not adjusted
commit https://github.com/vim/vim/commit/c1a9bc1a7284bd0e60f9bddfef6a4ee733bfc838
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 28 21:59:29 2018 +0100
patch 8.1.0654: when deleting a line text property flags are not adjusted
Problem: When deleting a line text property flags are not adjusted.
Solution: Adjust text property flags in preceding and following lines.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 28 Dec 2018 22:00:05 +0100 |
parents | 27783a6f430b |
children | 2d8225cc1315 |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -197,6 +197,16 @@ func Test_prop_clear_buf() bwipe! endfunc +" Setup a three line prop in lines 2 - 4. +" Add short props in line 1 and 5. +func Setup_three_line_prop() + new + call setline(1, ['one', 'twotwo', 'three', 'fourfour', 'five']) + call prop_add(1, 2, {'length': 1, 'type': 'comment'}) + call prop_add(2, 4, {'end_lnum': 4, 'end_col': 5, 'type': 'comment'}) + call prop_add(5, 2, {'length': 1, 'type': 'comment'}) +endfunc + func Test_prop_multiline() call prop_type_add('comment', {'highlight': 'Directory'}) new @@ -223,6 +233,30 @@ func Test_prop_multiline() call prop_clear(1, 3) bwipe! + + " Test deleting the first line with a prop. + call Setup_three_line_prop() + let expect2 = {'col': 4, 'length': 4, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0} + call assert_equal([expect2], prop_list(2)) + 2del + let expect_short = {'col': 2, 'length': 1, 'type': 'comment', 'start': 1, 'end': 1, 'id': 0} + call assert_equal([expect_short], prop_list(1)) + let expect2 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0} + call assert_equal([expect2], prop_list(2)) + bwipe! + + " Test deleting the last line with a prop. + call Setup_three_line_prop() + let expect3 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0} + call assert_equal([expect3], prop_list(3)) + let expect4 = {'col': 1, 'length': 5, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0} + call assert_equal([expect4], prop_list(4)) + 4del + let expect3 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0} + call assert_equal([expect3], prop_list(3)) + call assert_equal([expect_short], prop_list(4)) + bwipe! + call prop_type_delete('comment') endfunc