patch 9.1.1874: short-description
Commit:
https://github.com/vim/vim/commit/f0e11d32799f31a510fce0f4bcb4b5cdd76400c2
Author: Girish Palya <[email protected]>
Date: Sun Oct 26 13:52:03 2025 +0000
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/popupmenu.c b/src/popupmenu.c
index 160eb60ab..d316ba99e 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 000000000..58a054fb5
--- /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 000000000..40423018a
--- /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 f88cac29e..7b1b092c4 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\<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
diff --git a/src/version.c b/src/version.c
index 5a528cc71..fd8ccb7c0 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,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vD5Gi-0041zj-Fc%40256bit.org.