Mercurial > vim
diff src/testdir/test_textprop.vim @ 19631:1d493fce1fbd v8.2.0372
patch 8.2.0372: prop_find() may not find text property at start of the line
Commit: https://github.com/vim/vim/commit/66b98854d86f641db036fd1e6cf20f7b8905344e
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 11 19:15:52 2020 +0100
patch 8.2.0372: prop_find() may not find text property at start of the line
Problem: Prop_find() may not find text property at start of the line.
Solution: Adjust the loop to find properties. (Axel Forsman, closes https://github.com/vim/vim/issues/5761,
closes #5663)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 11 Mar 2020 21:31:02 +0100 |
parents | 67f39cb0a49c |
children | 647ef636a11e |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -1166,3 +1166,30 @@ func Test_textprop_ins_str() call prop_remove({'type': 'test'}) call prop_type_delete('test') endfunc + +func Test_find_prop_later_in_line() + new + call prop_type_add('test', {'highlight': 'ErrorMsg'}) + call setline(1, 'just some text') + call prop_add(1, 1, {'length': 4, 'type': 'test'}) + call prop_add(1, 10, {'length': 3, 'type': 'test'}) + + call assert_equal({'id': 0, 'lnum': 1, 'col': 10, 'end': 1, 'type': 'test', 'length': 3, 'start': 1}, + \ prop_find(#{type: 'test', lnum: 1, col: 6})) + + bwipe! + call prop_type_delete('test') +endfunc + +func Test_find_zerowidth_prop_sol() + new + call prop_type_add('test', {'highlight': 'ErrorMsg'}) + call setline(1, 'just some text') + call prop_add(1, 1, {'length': 0, 'type': 'test'}) + + call assert_equal({'id': 0, 'lnum': 1, 'col': 1, 'end': 1, 'type': 'test', 'length': 0, 'start': 1}, + \ prop_find(#{type: 'test', lnum: 1})) + + bwipe! + call prop_type_delete('test') +endfunc