diff --git a/src/popupmenu.c b/src/popupmenu.c index 160eb60ab0..d316ba99ed 100644 --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -2234,16 +2234,19 @@ pum_draw_border(void) } /* - * Get the underlying character and redraw with shadow highlight + * Get the underlying character and redraw with shadow highlight. + * Preserve bold, italic, underline, and reverse text underneath the shadow. */ void put_shadow_char(int row, int col) { char_u buf[MB_MAXBYTES + 1]; - int attr = highlight_attr[HLF_PMS]; + int shadow_attr = highlight_attr[HLF_PMS]; + int char_attr, new_attr; - screen_getbytes(row, col, buf, NULL); - screen_putchar((*mb_ptr2char)(buf), row, col, attr); + screen_getbytes(row, col, buf, &char_attr); + new_attr = hl_combine_attr(char_attr, shadow_attr); + screen_putchar((*mb_ptr2char)(buf), row, col, new_attr); } /* diff --git a/src/testdir/dumps/Test_popup_shadow_hiddenchar_1.dump b/src/testdir/dumps/Test_popup_shadow_hiddenchar_1.dump new file mode 100644 index 0000000000..58a054fb54 --- /dev/null +++ b/src/testdir/dumps/Test_popup_shadow_hiddenchar_1.dump @@ -0,0 +1,8 @@ +>b+2&#ffffff0|o|l|d| +0&&|i+12&&|t|a|l|i|c| +0&&|u+12&&|n|d|e|r|l|i|n|e| +0&&|r+1&&|e|v|e|r|s|e| +0&&|n|o|r|m|a|l| @38 +|b+0#0000001#ffd7ff255|o|l|d| @10|e+12#0000000#ffffff0| +0&&|r+1&&|e|v|e|r|s|e| +0&&|n|o|r|m|a|l| |b+2&&|o|l|d| +0&&@38 +|i+0#0000001#ffd7ff255|t|a|l|i|c| @8|s+1#6c6c6c255#0000001|e| +0#0000000#ffffff0|n|o|r|m|a|l| |b+2&&|o|l|d| +0&&|i+12&&|t|a|l|i|c| +0&&@38 +|u+0#0000001#ffd7ff255|n|d|e|r|l|i|n|e| @5|b+2#6c6c6c255#0000001|o|l+2#0000000#ffffff0|d| +0&&|i+12&&|t|a|l|i|c| +0&&|u+12&&|n|d|e|r|l|i|n|e| +0&&@38 +|r+0#0000001#ffd7ff255|e|v|e|r|s|e| @7|l+12#6c6c6c255#0000001|i|c+12#0000000#ffffff0| +0&&|u+12&&|n|d|e|r|l|i|n|e| +0&&|r+1&&|e|v|e|r|s|e| +0&&@38 +|n+0#0000001#ffd7ff255|o|r|m|a|l| @8| +0#6c6c6c255#0000001@1| +0#4040ff13#ffffff0@57 +|~| | +0#6c6c6c255#0000001@14| +0#4040ff13#ffffff0@57 +|~| @73 diff --git a/src/testdir/dumps/Test_popup_shadow_hiddenchar_2.dump b/src/testdir/dumps/Test_popup_shadow_hiddenchar_2.dump new file mode 100644 index 0000000000..40423018a4 --- /dev/null +++ b/src/testdir/dumps/Test_popup_shadow_hiddenchar_2.dump @@ -0,0 +1,8 @@ +|b+2&#ffffff0|o|l|d| +0&&|i+12&&|t|a|l|i|c| +0&&>u+12&&|n|d|e|r|l|i|n|e| +0&&|r+1&&|e|v|e|r|s|e| +0&&|n|o|r|m|a|l| @38 +|i+12&&|t|a|l|i|c| +0&&|u+12&&|n|d|e| +0#0000001#ffd7ff255|u|n|d|e|r|l|i|n|e| @5|r+0#0000000#ffffff0|m|a|l| |b+2&&|o|l|d| +0&&@38 +|u+12&&|n|d|e|r|l|i|n|e| +0&&|r+1&&| +0#0000001#ffd7ff255|r|e|v|e|r|s|e| @7|l+2#6c6c6c255#0000001|d| +0#0000000#ffffff0|i+12&&|t|a|l|i|c| +0&&@38 +|r+1&&|e|v|e|r|s|e| +0&&|n|o|r| +0#0000001#ffd7ff255|n|o|r|m|a|l| @8|u+12#6c6c6c255#0000001|n|d+12#0000000#ffffff0|e|r|l|i|n|e| +0&&@38 +|n|o|r|m|a|l| |b+2&&|o|l|d| +0#0000001#ffd7ff255|i|t|a|l|i|c| @8|e+12#6c6c6c255#0000001| +0&&|r+1#0000000#ffffff0|e|v|e|r|s|e| +0&&@38 +|~+0#4040ff13&| @9| +0#0000001#ffd7ff255|b|o|l|d| @10| +0#6c6c6c255#0000001@1| +0#4040ff13#ffffff0@45 +|~| @11| +0#6c6c6c255#0000001@15| +0#4040ff13#ffffff0@45 +|~| @73 diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index f88cac29e5..7b1b092c4d 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -2385,4 +2385,37 @@ func Test_popup_border() call StopVimInTerminal(buf) endfunc +func Test_popup_shadow_hiddenchar() + CheckScreendump + + let lines =<< trim END + bold italic underline reverse normal + italic underline reverse normal bold + underline reverse normal bold italic + reverse normal bold italic underline + normal bold italic underline reverse + END + call writefile(lines, 'Xtest', 'D') + let buf = RunVimInTerminal('Xtest', {'cols': 75}) + + call term_sendkeys(buf, ":set completeopt=menuone,noselect pumborder=shadow\") + call term_sendkeys(buf, ":hi BoldGrp cterm=bold\") + call term_sendkeys(buf, ":hi ItalicGrp cterm=italic,underline\") + call term_sendkeys(buf, ":hi ReverseGrp cterm=reverse\") + call term_sendkeys(buf, ":call matchadd(\"BoldGrp\", \"bold\")\") + call term_sendkeys(buf, ":call matchadd(\"ItalicGrp\", \"italic\")\") + call term_sendkeys(buf, ":call matchadd(\"ItalicGrp\", \"underline\")\") + call term_sendkeys(buf, ":call matchadd(\"ReverseGrp\", \"reverse\")\") + + call term_sendkeys(buf, "i\") + call TermWait(buf, 10) + call VerifyScreenDump(buf, 'Test_popup_shadow_hiddenchar_1', {'rows': 8}) + call term_sendkeys(buf, "\wwi\") + call TermWait(buf, 10) + call VerifyScreenDump(buf, 'Test_popup_shadow_hiddenchar_2', {'rows': 8}) + call term_sendkeys(buf, "\") + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 5a528cc713..fd8ccb7c0b 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1874, /**/ 1873, /**/