]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1874: short-description v9.1.1874
authorGirish Palya <girishji@gmail.com>
Sun, 26 Oct 2025 13:52:03 +0000 (13:52 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 26 Oct 2025 13:52:03 +0000 (13:52 +0000)
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>
src/popupmenu.c
src/testdir/dumps/Test_popup_shadow_hiddenchar_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_popup_shadow_hiddenchar_2.dump [new file with mode: 0644]
src/testdir/test_popup.vim
src/version.c

index 160eb60ab0cdab4fb2cc191ac6bf1ffa848499b1..d316ba99edf740cce2e3c39b95b19b8f3d410fd6 100644 (file)
@@ -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 (file)
index 0000000..58a054f
--- /dev/null
@@ -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 (file)
index 0000000..4042301
--- /dev/null
@@ -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
index f88cac29e514a71e0bb2546444ff0e3a25bf1c7b..7b1b092c4d1799b94b43eca0ad0a9169d410ee94 100644 (file)
@@ -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
index 5a528cc713a009ae6ea10ab6c5b597ebd07f13fa..fd8ccb7c0b49d1c68f994b0348240614834fc2a5 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1874,
 /**/
     1873,
 /**/