From f396ce83eebf6c61596184231d39ce4d41eeac04 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 23 Aug 2022 18:39:37 +0100 Subject: 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 #10906) --- .../dumps/Test_prop_right_align_twice_2.dump | 6 +-- .../dumps/Test_prop_text_with_padding_1.dump | 8 ++++ .../dumps/Test_prop_text_with_padding_2.dump | 8 ++++ .../dumps/Test_prop_text_with_padding_3.dump | 8 ++++ .../dumps/Test_prop_with_text_after_wraps_1.dump | 4 +- src/testdir/test_textprop.vim | 50 ++++++++++++++++++++++ 6 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 src/testdir/dumps/Test_prop_text_with_padding_1.dump create mode 100644 src/testdir/dumps/Test_prop_text_with_padding_2.dump create mode 100644 src/testdir/dumps/Test_prop_text_with_padding_3.dump (limited to 'src/testdir') diff --git a/src/testdir/dumps/Test_prop_right_align_twice_2.dump b/src/testdir/dumps/Test_prop_right_align_twice_2.dump index dd41c86cf..c4cd617f0 100644 --- a/src/testdir/dumps/Test_prop_right_align_twice_2.dump +++ b/src/testdir/dumps/Test_prop_right_align_twice_2.dump @@ -1,8 +1,8 @@ -|s+0&#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t|s|o|m|e| |t|e|x|t| |s|o|m|e| |t|e|x|t| |s|o|m|e| |t|e|x|t| |s|o|m|e| |t|e|x|t| +0&#ffd7ff255|n|o|t|h|i|n|g| |h|e|r|e|S+0#ffffff16#e000002|o|m|e| |e|r@1|o -|r| +0#0000000#ffffff0@60|A+0#ffffff16#e000002|n|o|t|h|e|r| |e|r@1|o|r +|s+0&#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t|s|o|m|e| |t|e|x|t| |s|o|m|e| |t|e|x|t| |s|o|m|e| |t|e|x|t| |s|o|m|e| |t|e|x|t| +0&#ffd7ff255|n|o|t|h|i|n|g| |h|e|r|e| +0&#ffffff0@8 +@65|S+0#ffffff16#e000002|o|m|e| |e|r@1|o|r +| +0#0000000#ffffff0@61|A+0#ffffff16#e000002|n|o|t|h|e|r| |e|r@1|o|r |l+0#0000000#ffffff0|i|n|e| |t|w>o| @66 |~+0#4040ff13&| @73 |~| @73 |~| @73 -|~| @73 | +0#0000000&@56|2|,|8| @10|A|l@1| diff --git a/src/testdir/dumps/Test_prop_text_with_padding_1.dump b/src/testdir/dumps/Test_prop_text_with_padding_1.dump new file mode 100644 index 000000000..1fde5e991 --- /dev/null +++ b/src/testdir/dumps/Test_prop_text_with_padding_1.dump @@ -0,0 +1,8 @@ +>S+0&#ffffff0|o|m|e| |t|e|x|t| |t|o| |a|d@1| |v|i|r|t|u|a|l| |t|e|x|t| |t|o|.| @2|a+0&#ffd7ff255|f|t|e|r| +0&#ffffff0@5|r+0&#ffd7ff255|i|g|h|t| |a|l|i|g|n|e|d +| +0&#ffffff0@3|b+0&#ffd7ff255|e|l|o|w| |t|h|e| |l|i|n|e| +0&#ffffff0@41 +|s|e|c|o|n|d| |l|i|n|e| @48 +|A|n|o|t|h|e|r| |l|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |t|o| |m|a|k|e| |t|h|e| |w|r|a|p|.| @5|r+0&#ffd7ff255|i|g|h|t|m|o|s|t +|~+0#4040ff13#ffffff0| @58 +|~| @58 +|~| @58 +| +0#0000000&@41|1|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_prop_text_with_padding_2.dump b/src/testdir/dumps/Test_prop_text_with_padding_2.dump new file mode 100644 index 000000000..abedaae6a --- /dev/null +++ b/src/testdir/dumps/Test_prop_text_with_padding_2.dump @@ -0,0 +1,8 @@ +|x+0&#ffffff0@9|S|o|m|e| |t|e|x|t| |t|o| |a|d@1| |v|i|r|t|u|a|l| |t|e|x|t| |t|o|.| @2|a+0&#ffd7ff255|f|t|e|r| +0&#ffffff0@4|r+0&#ffd7ff255|i|g|… +| +0&#ffffff0@3|b+0&#ffd7ff255|e|l|o|w| |t|h|e| |l|i|n|e| +0&#ffffff0@41 +|s|e|c|o|n|d| |l|i|n|e| @48 +>x|A|n|o|t|h|e|r| |l|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |t|o| |m|a|k|e| |t|h|e| |w|r|a|p|.| @13 +@51|r+0&#ffd7ff255|i|g|h|t|m|o|s|t +|~+0#4040ff13#ffffff0| @58 +|~| @58 +| +0#0000000&@41|3|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_prop_text_with_padding_3.dump b/src/testdir/dumps/Test_prop_text_with_padding_3.dump new file mode 100644 index 000000000..2911162dc --- /dev/null +++ b/src/testdir/dumps/Test_prop_text_with_padding_3.dump @@ -0,0 +1,8 @@ +>x+0&#ffffff0@10|S|o|m|e| |t|e|x|t| |t|o| |a|d@1| |v|i|r|t|u|a|l| |t|e|x|t| |t|o|.| @2|a+0&#ffd7ff255|f|t|e|r| +0&#ffffff0@7 +@47|r+0&#ffd7ff255|i|g|h|t| |a|l|i|g|n|e|d +| +0&#ffffff0@3|b+0&#ffd7ff255|e|l|o|w| |t|h|e| |l|i|n|e| +0&#ffffff0@41 +|s|e|c|o|n|d| |l|i|n|e| @48 +|x|A|n|o|t|h|e|r| |l|i|n|e| |w|i|t|h| |s|o|m|e| |t|e|x|t| |t|o| |m|a|k|e| |t|h|e| |w|r|a|p|.| @13 +@51|r+0&#ffd7ff255|i|g|h|t|m|o|s|t +|~+0#4040ff13#ffffff0| @58 +| +0#0000000&@41|1|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_prop_with_text_after_wraps_1.dump b/src/testdir/dumps/Test_prop_with_text_after_wraps_1.dump index 674ea84c5..7642f8fb5 100644 --- a/src/testdir/dumps/Test_prop_with_text_after_wraps_1.dump +++ b/src/testdir/dumps/Test_prop_with_text_after_wraps_1.dump @@ -1,8 +1,8 @@ |o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|O|N|E| |a|n|d| |T|W|O| |a|n|d| |T|H|R|E@1| |a|n|d| |F|O|U|R| |a|n|d| |F|I|V|E| +0&#ffffff0@46 -|o|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| -|f|o|u|r| |A|N|D| |f|i|v|e| +0&#ffffff0@46 |o|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| @26 +@20| +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |A|N|D| |f|i|v|e +|o+0&#ffffff0|n|e| |t|w|o| |t|h|r|e@1| |f|o|u|r| |f|i|v|e| |s|i|x| |s|e|v|e|n| @26 | +0&#ffff4012|o|n|e| |A|N|D| |t|w|o| |A|N|D| |t|h|r|e@1| |A|N|D| |f|o|u|r| |A|N|D| |f|i|v|e| |l|e|t|s| |w|r|a|p| |a|f|t|e|r| |s|o|m |e| |m|o|r|e| |t|e|x|t| +0&#ffffff0@48 |c|u|r|s|o|r| >h|e|r|e| @48 diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index a7646209e..0c7e91d09 100644 --- 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\") + call term_sendkeys(buf, "3Gix\") + call VerifyScreenDump(buf, 'Test_prop_text_with_padding_2', {}) + + call term_sendkeys(buf, "ggix\") + call VerifyScreenDump(buf, 'Test_prop_text_with_padding_3', {}) + + call StopVimInTerminal(buf) + call delete('XscriptPropsPadded') +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit v1.2.1