Mercurial > vim
diff src/testdir/test_textprop.vim @ 28526:171f9def0398 v8.2.4787
patch 8.2.4787: prop_find() does not find the right property
Commit: https://github.com/vim/vim/commit/9bd3ce22e36b5760a5e22e7d34d1bd6a3411258e
Author: LemonBoy <thatlemon@gmail.com>
Date: Mon Apr 18 21:54:02 2022 +0100
patch 8.2.4787: prop_find() does not find the right property
Problem: prop_find() does not find the right property.
Solution: Fix the scan order. (closes https://github.com/vim/vim/issues/10220)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 18 Apr 2022 23:00:03 +0200 |
parents | 95d6e3c9aa1e |
children | 77a00aa3e215 |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -1847,4 +1847,28 @@ func Test_prop_list() call v9.CheckLegacyAndVim9Success(lines) endfunc +func Test_prop_find_prev_on_same_line() + new + + call setline(1, 'the quikc bronw fox jumsp over the layz dog') + call prop_type_add('misspell', #{highlight: 'ErrorMsg'}) + for col in [8, 14, 24, 38] + call prop_add(1, col, #{type: 'misspell', length: 2}) + endfor + + call cursor(1,18) + let expected = [ + \ #{lnum: 1, id: 0, col: 14, end: 1, type: 'misspell', type_bufnr: 0, length: 2, start: 1}, + \ #{lnum: 1, id: 0, col: 24, end: 1, type: 'misspell', type_bufnr: 0, length: 2, start: 1} + \ ] + + let result = prop_find(#{type: 'misspell'}, 'b') + call assert_equal(expected[0], result) + let result = prop_find(#{type: 'misspell'}, 'f') + call assert_equal(expected[1], result) + + call prop_type_delete('misspell') + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab