Mercurial > vim
diff src/testdir/test_textprop.vim @ 29816:bbe62ea78aac v9.0.0247
patch 9.0.0247: cannot add padding to virtual text without highlight
Commit: https://github.com/vim/vim/commit/f396ce83eebf6c61596184231d39ce4d41eeac04
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 23 18:39:37 2022 +0100
patch 9.0.0247: cannot add padding to virtual text without highlight
Problem: Cannot add padding to virtual text without highlight.
Solution: Add the "text_padding_left" argument. (issue https://github.com/vim/vim/issues/10906)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 23 Aug 2022 19:45:05 +0200 |
parents | d08aa1bfe319 |
children | bfd08e50e2c0 |
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -3041,4 +3041,54 @@ func Test_insert_text_list_mode() call delete('XscriptPropsListMode') endfunc +func Test_insert_text_with_padding() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + setline(1, ['Some text to add virtual text to.', + 'second line', + 'Another line with some text to make the wrap.']) + prop_type_add('theprop', {highlight: 'DiffChange'}) + prop_add(1, 0, { + type: 'theprop', + text: 'after', + text_align: 'after', + text_padding_left: 3, + }) + prop_add(1, 0, { + type: 'theprop', + text: 'right aligned', + text_align: 'right', + text_padding_left: 5, + }) + prop_add(1, 0, { + type: 'theprop', + text: 'below the line', + text_align: 'below', + text_padding_left: 4, + }) + prop_add(3, 0, { + type: 'theprop', + text: 'rightmost', + text_align: 'right', + text_padding_left: 6, + text_wrap: 'wrap', + }) + END + call writefile(lines, 'XscriptPropsPadded') + let buf = RunVimInTerminal('-S XscriptPropsPadded', #{rows: 8, cols: 60}) + call VerifyScreenDump(buf, 'Test_prop_text_with_padding_1', {}) + + call term_sendkeys(buf, "ggixxxxxxxxxx\<Esc>") + call term_sendkeys(buf, "3Gix\<Esc>") + call VerifyScreenDump(buf, 'Test_prop_text_with_padding_2', {}) + + call term_sendkeys(buf, "ggix\<Esc>") + call VerifyScreenDump(buf, 'Test_prop_text_with_padding_3', {}) + + call StopVimInTerminal(buf) + call delete('XscriptPropsPadded') +endfunc + " vim: shiftwidth=2 sts=2 expandtab