To: vim_dev@googlegroups.com Subject: Patch 9.0.0894 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0894 Problem: Virtual text property highlight ignores window background. Solution: Combine text prop attribute with win_attr into extra_attr. (closes #11462) Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_virtual_text_in_popup_highlight_1.dump *** ../vim-9.0.0893/src/drawline.c 2022-11-16 22:12:34.417823681 +0000 --- src/drawline.c 2022-11-17 14:39:49.806885991 +0000 *************** *** 130,136 **** 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 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 --- 130,137 ---- 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, 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,2003 **** wlv.c_final = NUL; wlv.n_extra = (int)STRLEN(p); wlv.extra_for_textprop = TRUE; ! wlv.extra_attr = used_attr; n_attr = mb_charlen(p); // restore search_attr and area_attr when n_extra // is down to zero --- 1998,2005 ---- wlv.c_final = NUL; wlv.n_extra = (int)STRLEN(p); wlv.extra_for_textprop = TRUE; ! 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 *** ../vim-9.0.0893/src/testdir/test_textprop.vim 2022-11-16 22:12:34.421823679 +0000 --- src/testdir/test_textprop.vim 2022-11-17 14:53:16.186716901 +0000 *************** *** 3422,3427 **** --- 3422,3471 ---- 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 *** ../vim-9.0.0893/src/testdir/dumps/Test_virtual_text_in_popup_highlight_1.dump 2022-11-17 14:55:21.390743941 +0000 --- src/testdir/dumps/Test_virtual_text_in_popup_highlight_1.dump 2022-11-17 14:53:26.726719715 +0000 *************** *** 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| *** ../vim-9.0.0893/src/version.c 2022-11-17 12:41:38.350199459 +0000 --- src/version.c 2022-11-17 14:41:39.354825665 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 894, /**/ -- From "know your smileys": :-O>-o Smiley American tourist (note big mouth and camera) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///