Mercurial > vim
diff src/testdir/test_textprop.vim @ 15251:17525ca95e1e v8.1.0634
patch 8.1.0634: text properties cannot cross line boundaries
commit https://github.com/vim/vim/commit/e3d31b02a56710e64ef0c1eb6ac5afcc57cb4890
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 24 23:07:04 2018 +0100
patch 8.1.0634: text properties cannot cross line boundaries
Problem: Text properties cannot cross line boundaries.
Solution: Support multi-line text properties.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 24 Dec 2018 23:15:05 +0100 |
parents | 9df130fd5e0d |
children | 19e79a1ed6b6 |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -197,4 +197,34 @@ func Test_prop_clear_buf() bwipe! endfunc +func Test_prop_multiline() + call prop_type_add('comment', {'highlight': 'Directory'}) + new + call setline(1, ['xxxxxxx', 'yyyyyyyyy', 'zzzzzzzz']) + + " start halfway line 1, end halfway line 3 + call prop_add(1, 3, {'end_lnum': 3, 'end_col': 5, 'type': 'comment'}) + let expect1 = {'col': 3, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0} + call assert_equal([expect1], prop_list(1)) + let expect2 = {'col': 1, 'length': 10, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0} + call assert_equal([expect2], prop_list(2)) + let expect3 = {'col': 1, 'length': 5, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0} + call assert_equal([expect3], prop_list(3)) + call prop_clear(1, 3) + + " include all three lines + call prop_add(1, 1, {'end_lnum': 3, 'end_col': 999, 'type': 'comment'}) + let expect1.col = 1 + let expect1.length = 8 + call assert_equal([expect1], prop_list(1)) + call assert_equal([expect2], prop_list(2)) + let expect3.length = 9 + call assert_equal([expect3], prop_list(3)) + call prop_clear(1, 3) + + bwipe! + call prop_type_delete('comment') +endfunc + + " TODO: screenshot test with highlighting