Mercurial > vim
diff src/testdir/test_textprop.vim @ 15365:01ee8dc12313 v8.1.0690
patch 8.1.0690: setline() and setbufline() do not clear text properties
commit https://github.com/vim/vim/commit/21b5038e02306ce2fd438249055eed372befe51f
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 4 18:07:24 2019 +0100
patch 8.1.0690: setline() and setbufline() do not clear text properties
Problem: setline() and setbufline() do not clear text properties.
Solution: Clear text properties when setting the text.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 04 Jan 2019 18:15:04 +0100 |
parents | 45f36b66a032 |
children | 273649cad196 |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -261,6 +261,35 @@ func Test_prop_clear_buf() bwipe! endfunc +func Test_prop_setline() + new + call AddPropTypes() + call SetupPropsInFirstLine() + call assert_equal(s:expected_props, prop_list(1)) + + call setline(1, 'foobar') + call assert_equal([], prop_list(1)) + + call DeletePropTypes() + bwipe! +endfunc + +func Test_prop_setbufline() + new + call AddPropTypes() + call SetupPropsInFirstLine() + let bufnr = bufnr('') + wincmd w + call assert_equal(s:expected_props, prop_list(1, {'bufnr': bufnr})) + + call setbufline(bufnr, 1, 'foobar') + call assert_equal([], prop_list(1, {'bufnr': bufnr})) + + wincmd w + call DeletePropTypes() + bwipe! +endfunc + " Setup a three line prop in lines 2 - 4. " Add short props in line 1 and 5. func Setup_three_line_prop()