]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1006: PmenuMatch completion highlight can be combined v9.1.1006
authorglepnir <glephunter@gmail.com>
Sat, 11 Jan 2025 15:47:34 +0000 (16:47 +0100)
committerChristian Brabandt <cb@256bit.org>
Sat, 11 Jan 2025 15:47:34 +0000 (16:47 +0100)
Problem:  PmenuMatch completion highlight can be combined
Solution: Combine highlight groups PmenuMatch with Pmenu and
          PmenuMatchSel with PmenuSel (glepnir)

fixes: #15563
closes: #16408

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/syntax.txt
src/popupmenu.c
src/testdir/dumps/Test_pum_highlights_18.dump [new file with mode: 0644]
src/testdir/test_popup.vim
src/version.c

index 7640ee1838a97d2782b3099bdb0b03eab931a20c..2fb320efcbecf0febff002d04e3e298c7cd4632e 100644 (file)
@@ -1,4 +1,4 @@
-*syntax.txt*   For Vim version 9.1.  Last change: 2024 Dec 16
+*syntax.txt*   For Vim version 9.1.  Last change: 2025 Jan 11
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -5854,9 +5854,11 @@ PmenuSbar        Popup menu: Scrollbar.
                                                        *hl-PmenuThumb*
 PmenuThumb     Popup menu: Thumb of the scrollbar.
                                                        *hl-PmenuMatch*
-PmenuMatch     Popup menu: Matched text in normal item.
+PmenuMatch     Popup menu: Matched text in normal item. Applied in
+               combination with |hl-Pmenu|.
                                                        *hl-PmenuMatchSel*
-PmenuMatchSel  Popup menu: Matched text in selected item.
+PmenuMatchSel  Popup menu: Matched text in selected item. Applied in
+               combination with |hl-PmenuSel|.
                                                        *hl-ComplMatchIns*
 ComplMatchIns  Matched text of the currently inserted completion.
                                                        *hl-PopupNotification*
index ea2edca9ab0bf24d82ed6282cc3d13a7637fcb07..14cc69a86e41bb586807341dda3f1d2ef7df1c01 100644 (file)
@@ -450,13 +450,18 @@ pum_compute_text_attrs(char_u *text, hlf_T hlf, int user_hlattr)
                if (char_pos == ((int_u *)ga->ga_data)[i])
                {
                    new_attr = highlight_attr[is_select ? HLF_PMSI : HLF_PMNI];
+                   new_attr = hl_combine_attr(highlight_attr[hlf], new_attr);
                    break;
                }
            }
        }
        else if (matched_start && ptr < text + leader_len)
+       {
            new_attr = highlight_attr[is_select ? HLF_PMSI : HLF_PMNI];
+           new_attr = hl_combine_attr(highlight_attr[hlf], new_attr);
+       }
 
+       new_attr = hl_combine_attr(highlight_attr[HLF_PNI], new_attr);
        if (user_hlattr > 0)
            new_attr = hl_combine_attr(new_attr, user_hlattr);
 
diff --git a/src/testdir/dumps/Test_pum_highlights_18.dump b/src/testdir/dumps/Test_pum_highlights_18.dump
new file mode 100644 (file)
index 0000000..a57f7a2
--- /dev/null
@@ -0,0 +1,20 @@
+|f+0&#ffffff0|b> @72
+|f+0#40ffff15#e0e0e08|o+0#0000001&@1|B+0#40ffff15&|a+0#0000001&|z| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0&#ffd7ff255|o+0#0000001&@1|b+0#4040ff13&|a+0#0000001&|r| @1|f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|f+0&#ffd7ff255|o+0#0000001&@1|b+0#4040ff13&|a+0#0000001&|l|a| |f|o@1|k|i|n|d| | +0#4040ff13#ffffff0@58
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |9| +0#0000000&@34
index 0303c42bd69f5036ad81f23b2903be0b17851ac2..08b9cd9ca93242e231b944f1e3287a5a0d591e12 100644 (file)
@@ -1511,6 +1511,16 @@ func Test_pum_highlights_match()
   call term_sendkeys(buf, "\<ESC>S/non_existing_folder\<C-X>\<C-F>")
   call TermWait(buf, 50)
   call VerifyScreenDump(buf, 'Test_pum_highlights_15', {})
+  call term_sendkeys(buf, "\<C-E>\<Esc>")
+
+  call term_sendkeys(buf, ":hi PmenuMatchSel ctermfg=14\<CR>")
+  call TermWait(buf, 50)
+  call term_sendkeys(buf, ":hi PmenuMatch ctermfg=12\<CR>")
+  call term_sendkeys(buf, ":set cot=menu,noinsert,fuzzy\<CR>")
+  call term_sendkeys(buf, "S\<C-X>\<C-O>")
+  call TermWait(buf, 50)
+  call term_sendkeys(buf, "fb")
+  call VerifyScreenDump(buf, 'Test_pum_highlights_18', {})
 
   call term_sendkeys(buf, "\<C-E>\<Esc>")
   call TermWait(buf)
index 1927d9e82e473e6e22a31a3ea262face8c86e70c..9d9f9053557465ce70a5e9522b95b8743efb7077 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1006,
 /**/
     1005,
 /**/