mirror of
https://github.com/vim/vim.git
synced 2025-11-15 23:14:06 -05:00
patch 9.1.1874: short-description
Problem: PMenuShadow overrides highlighting attributes
(Maxim Kim)
Solution: Use hl_combine_attr() to combine popup attribute with shadow
attribute (Girish Palya)
fixes: #18557
closes: #18634
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
842c7788a5
commit
f0e11d3279
@@ -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
|
void
|
||||||
put_shadow_char(int row, int col)
|
put_shadow_char(int row, int col)
|
||||||
{
|
{
|
||||||
char_u buf[MB_MAXBYTES + 1];
|
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_getbytes(row, col, buf, &char_attr);
|
||||||
screen_putchar((*mb_ptr2char)(buf), row, col, attr);
|
new_attr = hl_combine_attr(char_attr, shadow_attr);
|
||||||
|
screen_putchar((*mb_ptr2char)(buf), row, col, new_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
8
src/testdir/dumps/Test_popup_shadow_hiddenchar_1.dump
Normal file
8
src/testdir/dumps/Test_popup_shadow_hiddenchar_1.dump
Normal file
@@ -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
|
||||||
8
src/testdir/dumps/Test_popup_shadow_hiddenchar_2.dump
Normal file
8
src/testdir/dumps/Test_popup_shadow_hiddenchar_2.dump
Normal file
@@ -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
|
||||||
@@ -2385,4 +2385,37 @@ func Test_popup_border()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
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\<CR>")
|
||||||
|
call term_sendkeys(buf, ":hi BoldGrp cterm=bold\<CR>")
|
||||||
|
call term_sendkeys(buf, ":hi ItalicGrp cterm=italic,underline\<CR>")
|
||||||
|
call term_sendkeys(buf, ":hi ReverseGrp cterm=reverse\<CR>")
|
||||||
|
call term_sendkeys(buf, ":call matchadd(\"BoldGrp\", \"bold\")\<CR>")
|
||||||
|
call term_sendkeys(buf, ":call matchadd(\"ItalicGrp\", \"italic\")\<CR>")
|
||||||
|
call term_sendkeys(buf, ":call matchadd(\"ItalicGrp\", \"underline\")\<CR>")
|
||||||
|
call term_sendkeys(buf, ":call matchadd(\"ReverseGrp\", \"reverse\")\<CR>")
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "i\<C-N>")
|
||||||
|
call TermWait(buf, 10)
|
||||||
|
call VerifyScreenDump(buf, 'Test_popup_shadow_hiddenchar_1', {'rows': 8})
|
||||||
|
call term_sendkeys(buf, "\<Esc>wwi\<C-N>")
|
||||||
|
call TermWait(buf, 10)
|
||||||
|
call VerifyScreenDump(buf, 'Test_popup_shadow_hiddenchar_2', {'rows': 8})
|
||||||
|
call term_sendkeys(buf, "\<Esc>")
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1874,
|
||||||
/**/
|
/**/
|
||||||
1873,
|
1873,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user