diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-08-20 18:27:45 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-08-20 18:27:45 +0200 |
commit | f9037f186ad45b56c84f1efdc131480bec159e4f (patch) | |
tree | b010fb2dbf1c4d0fd4f117c5d167b8c55a340624 /src/testdir/test_textprop.vim | |
parent | 654bdbbd329e7267051cc2eb496bc52b66053081 (diff) |
patch 9.0.1762: Not able to get the virtual text propertyv9.0.1762
Problem: Not able to get the virtual text property
Solution: Make prop_list() return virtual text and alignment
closes: #12860
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/testdir/test_textprop.vim')
-rw-r--r-- | src/testdir/test_textprop.vim | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 9b03d10fbe..9cf46d7d9b 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -4025,4 +4025,39 @@ func Test_text_prop_list_hl_and_sign_highlight() call StopVimInTerminal(buf) endfunc + +" Test for getting the virtual text properties +func Test_virtual_text_get() + new foobar + call setline(1, '12345678') + call prop_type_add('test', #{highlight: 'Search'}) + call prop_add(1, 2, #{type: 'test', text: ' virtual text1 '}) + call prop_add(1, 3, #{type: 'test'}) + call prop_add(1, 0, #{type: 'test', text: ' virtual text2 ', + \ text_align: 'right'}) + call prop_add(1, 5, #{type: 'test'}) + call prop_add(1, 6, #{type: 'test', text: ' virtual text3 ', + \ text_wrap: 'wrap'}) + + let p = prop_list(1, #{end_lnum: -1}) + call assert_equal( + \ #{lnum: 1, id: -1, col: 2, type_bufnr: 0, end: 1, + \ type: 'test', length: 1, start: 1, + \ text: ' virtual text1 '}, p[0]) + call assert_equal( + \ #{lnum: 1, id: 0, col: 3, type_bufnr: 0, end: 1, + \ type: 'test', length: 0, start: 1}, p[1]) + call assert_equal( + \ #{lnum: 1, id: 0, col: 5, type_bufnr: 0, end: 1, + \ type: 'test', length: 0, start: 1}, p[2]) + call assert_equal( + \ #{lnum: 1, id: -3, col: 6, type_bufnr: 0, end: 1, type: 'test', + \ text_wrap: 'wrap', length: 1, start: 1, text: ' virtual text3 '}, + \ p[3]) + call assert_equal('right', p[4].text_align) + + call prop_type_delete('test') + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |