summaryrefslogtreecommitdiff
path: root/src/testdir/test_textprop.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-28 21:59:29 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-28 21:59:29 +0100
commitc1a9bc1a7284bd0e60f9bddfef6a4ee733bfc838 (patch)
tree9c266841989772395105befd1d5a14c573905a5e /src/testdir/test_textprop.vim
parent3de8c2d1f027410db6a06f0fcd3355d96c8b8596 (diff)
downloadvim-git-c1a9bc1a7284bd0e60f9bddfef6a4ee733bfc838.tar.gz
patch 8.1.0654: when deleting a line text property flags are not adjustedv8.1.0654
Problem: When deleting a line text property flags are not adjusted. Solution: Adjust text property flags in preceding and following lines.
Diffstat (limited to 'src/testdir/test_textprop.vim')
-rw-r--r--src/testdir/test_textprop.vim34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index e63ce6bf0..fbcb132a2 100644
--- 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