diff options
-rw-r--r-- | src/drawline.c | 6 | ||||
-rw-r--r-- | src/testdir/dumps/Test_virtual_text_in_popup_highlight_1.dump | 8 | ||||
-rw-r--r-- | src/testdir/test_textprop.vim | 44 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 58 insertions, 2 deletions
diff --git a/src/drawline.c b/src/drawline.c index 90fbc2b1da..137b888654 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -130,7 +130,8 @@ typedef struct { char_u *p_extra; // string of extra chars, plus NUL, only used // when c_extra and c_final are NUL char_u *p_extra_free; // p_extra buffer that needs to be freed - int extra_attr; // attributes for p_extra + int extra_attr; // attributes for p_extra, should be combined + // with win_attr if needed int c_extra; // extra chars, all the same int c_final; // final char, mandatory if set int extra_for_textprop; // wlv.n_extra set for textprop @@ -1997,7 +1998,8 @@ win_line( wlv.c_final = NUL; wlv.n_extra = (int)STRLEN(p); wlv.extra_for_textprop = TRUE; - wlv.extra_attr = used_attr; + wlv.extra_attr = hl_combine_attr(wlv.win_attr, + used_attr); n_attr = mb_charlen(p); // restore search_attr and area_attr when n_extra // is down to zero diff --git a/src/testdir/dumps/Test_virtual_text_in_popup_highlight_1.dump b/src/testdir/dumps/Test_virtual_text_in_popup_highlight_1.dump new file mode 100644 index 0000000000..b8c5b14a1e --- /dev/null +++ b/src/testdir/dumps/Test_virtual_text_in_popup_highlight_1.dump @@ -0,0 +1,8 @@ +> +0&#ffffff0@74 +|~+0#4040ff13&| @73 +|~| @17| +0#0000001#ffd7ff255@16| +0#4040ff13#ffffff0@38 +|~| @17| +0#0000001#ffd7ff255| +0#0000e05&|+| |S+0#0000001&|o|m|e| | +0#4040ff13#afffff255|x| |t+0#0000001#ffd7ff255|e|x|t| | +0#4040ff13#ffffff0@38 +|~| @17| +0#0000001#ffd7ff255@16| +0#4040ff13#ffffff0@38 +|~| @73 +|~| @73 +| +0#0000000&@56|0|,|0|-|1| @8|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index 1bd115b4e3..c03c5b3fb7 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -3422,6 +3422,50 @@ func Test_text_below_nowrap() call StopVimInTerminal(buf) endfunc +func Test_virtual_text_in_popup_highlight() + CheckRunVimInTerminal + + let lines =<< trim END + vim9script + + # foreground highlight only, popup background is used + prop_type_add('Prop1', {'highlight': 'SpecialKey'}) + # foreground and background highlight, popup background is not used + prop_type_add('Prop2', {'highlight': 'DiffDelete'}) + + var popupText = [{ + text: 'Some text', + props: [ + { + col: 1, + type: 'Prop1', + text: ' + ' + }, + { + col: 6, + type: 'Prop2', + text: ' x ' + }, + ] + }] + var popupArgs = { + line: 3, + col: 20, + maxwidth: 80, + highlight: 'PMenu', + border: [], + borderchars: [' '], + } + + popup_create(popupText, popupArgs) + END + call writefile(lines, 'XscriptVirtualHighlight', 'D') + let buf = RunVimInTerminal('-S XscriptVirtualHighlight', #{rows: 8}) + call VerifyScreenDump(buf, 'Test_virtual_text_in_popup_highlight_1', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_insert_text_change_arg() CheckRunVimInTerminal diff --git a/src/version.c b/src/version.c index cfdd33a74e..f4e9ee1954 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 894, +/**/ 893, /**/ 892, |