]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0493: popup: missing Popup, PopupBorder and PopupTitle hi groups v9.2.0493
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Sun, 17 May 2026 17:42:27 +0000 (17:42 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 17 May 2026 17:49:42 +0000 (17:49 +0000)
Problem:  popup: missing Popup, PopupBorder and PopupTitle highlight groups
Solution: add Popup, PopupBorder and PopupTitle highlight groups and
          fall back to Pmenu related highlighting groups (Yasuhiro Matsumoto).

fixes:  #20110
closes: #20208

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
13 files changed:
runtime/doc/options.txt
runtime/doc/popup.txt
runtime/doc/syntax.txt
runtime/doc/tags
runtime/doc/version9.txt
runtime/syntax/vim.vim
src/highlight.c
src/optiondefs.h
src/popupwin.c
src/screen.c
src/testdir/test_highlight.vim
src/version.c
src/vim.h

index 99e4e70a3a94896634c1608b0b2f291394795e8d..1c1100a981ca79d67d9567be6773bbd41cc5a368 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.2.  Last change: 2026 May 10
+*options.txt*  For Vim version 9.2.  Last change: 2026 May 17
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -4774,7 +4774,8 @@ A jump table for the options with a short description can be found at |Q_op|.
                                     [:PmenuKind,]:PmenuKindSel,
                                     {:PmenuExtra,}:PmenuExtraSel,
                                     x:PmenuSbar,X:PmenuThumb,j:PmenuBorder,
-                                    H:PmenuShadow,*:TabLine,
+                                    H:PmenuShadow,p:Popup,J:PopupBorder,
+                                    Q:PopupTitle,*:TabLine,
                                     #:TabLineSel,_:TabLineFill,!:CursorColumn,
                                     .:CursorLine,o:ColorColumn,q:QuickFixLine,
                                     z:StatusLineTerm,Z:StatusLineTermNC,
@@ -4845,6 +4846,9 @@ A jump table for the options with a short description can be found at |Q_op|.
        |hl-PmenuMatchSel| <  popup menu matched text in selected line
        |hl-PmenuBorder|   j  popup menu border characters
        |hl-PmenuShadow|   H  popup menu shadow
+       |hl-Popup|       p  popup window body
+       |hl-PopupBorder|   J  popup window border characters
+       |hl-PopupTitle|  Q  popup window title
        |hl-PreInsert|   I  text inserted when "preinsert" is in 'completeopt'
        |hl-Normal|      (  Window color (supersedes 'wincolor' option)
 
index 2afa93a7565f3253adf826546140be9cadde5bab..2e9124477883cc153c59c5e4bfc10186d4687902 100644 (file)
@@ -1,4 +1,4 @@
-*popup.txt*    For Vim version 9.2.  Last change: 2026 May 10
+*popup.txt*    For Vim version 9.2.  Last change: 2026 May 17
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -44,8 +44,11 @@ A popup window can be used for such things as:
 The text in the popup window can be colored with |text-properties|.  It is
 also possible to use syntax highlighting.
 
-The default color used is "Pmenu".  If you prefer something else use the
-"highlight" argument or the 'wincolor' option, e.g.: >
+The default colors are taken from |hl-Popup| (body), |hl-PopupBorder|
+(border) and |hl-PopupTitle| (title), which all link to |hl-Pmenu| by
+default for backward compatibility.  Override them to give general popup
+windows a different look than the popup completion menu, or use the
+"highlight" argument or the 'wincolor' option for a per-popup override: >
        hi MyPopupColor ctermbg=lightblue guibg=lightblue
        call setwinvar(winid, '&wincolor', 'MyPopupColor')
 
@@ -760,6 +763,10 @@ The second argument of |popup_create()| is a dictionary with options:
                        border one line of padding is added to put the title
                        on.  You might want to add one or more spaces at the
                        start and end as padding.
+                       The title uses |hl-PopupTitle| by default; if
+                       "borderhighlight" is set the top border highlight is
+                       used instead, and if "highlight"/'wincolor' is set
+                       that is used.
        wrap            TRUE to make the lines wrap (default TRUE).
        drag            TRUE to allow the popup to be dragged with the mouse
                        by grabbing at the border.  Has no effect if the
@@ -808,6 +815,8 @@ The second argument of |popup_create()| is a dictionary with options:
                        the highlight for the top/right/bottom/left border.
                        Example: ['TopColor', 'RightColor', 'BottomColor,
                        'LeftColor']
+                       When not given and "highlight"/'wincolor' is also not
+                       set, |hl-PopupBorder| is used.
        borderchars     List with characters, defining the character to use
                        for the top/right/bottom/left border.  Optionally
                        followed by the character to use for the
index c74f95e8080042ef31069d4bd2bf382d9df88336..428e8a552225b889a462ab3b99d0da050036e5ac 100644 (file)
@@ -1,4 +1,4 @@
-*syntax.txt*   For Vim version 9.2.  Last change: 2026 May 15
+*syntax.txt*   For Vim version 9.2.  Last change: 2026 May 17
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -6077,6 +6077,18 @@ PmenuShadow      Popup menu: Used for shadow.
 ComplMatchIns  Matched text of the currently inserted completion.
                                                        *hl-PreInsert*
 PreInsert      Text inserted when "preinsert" is in 'completeopt'.
+                                                       *hl-Popup*
+Popup          Popup window body, used when neither the popup's 'wincolor'
+               nor explicit "highlight" argument is set.  Linked to |hl-Pmenu|
+               by default.
+                                                       *hl-PopupBorder*
+PopupBorder    Popup window border characters, used when "borderhighlight" is
+               not set and the popup's 'wincolor' is also not set.
+               Linked to |hl-Pmenu| by default.
+                                                       *hl-PopupTitle*
+PopupTitle     Popup window title, used when "borderhighlight" is not set and
+               the popup's 'wincolor' is also not set.  Linked to
+               |hl-Pmenu| by default.
                                                        *hl-PopupSelected*
 PopupSelected  Popup window created with |popup_menu()|.  Linked to
                |hl-PmenuSel| by default.
index d5a8a1b30c8d38ca37f75004bf22f068eb2cccf1..b94169f0f12611ea70c8af52e03d59e35817de27 100644 (file)
@@ -8464,8 +8464,11 @@ hl-PmenuSbar     syntax.txt      /*hl-PmenuSbar*
 hl-PmenuSel    syntax.txt      /*hl-PmenuSel*
 hl-PmenuShadow syntax.txt      /*hl-PmenuShadow*
 hl-PmenuThumb  syntax.txt      /*hl-PmenuThumb*
+hl-Popup       syntax.txt      /*hl-Popup*
+hl-PopupBorder syntax.txt      /*hl-PopupBorder*
 hl-PopupNotification   syntax.txt      /*hl-PopupNotification*
 hl-PopupSelected       syntax.txt      /*hl-PopupSelected*
+hl-PopupTitle  syntax.txt      /*hl-PopupTitle*
 hl-PreInsert   syntax.txt      /*hl-PreInsert*
 hl-Question    syntax.txt      /*hl-Question*
 hl-QuickFixLine        syntax.txt      /*hl-QuickFixLine*
index 5121fe90c6f4faf982d8b274eb3c0032ce7bd63d..5b4bb1990610d4bde05652a82dcd4ac77aa5f6bb 100644 (file)
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.2.  Last change: 2026 May 11
+*version9.txt* For Vim version 9.2.  Last change: 2026 May 17
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41880,6 +41880,9 @@ Highlighting: ~
 |hl-PmenuMatchSel|     Popup menu: highlighting of matched text in selected
                        line
 |hl-PmenuShadow|       Popup menu: highlighting of the popup shadow
+|hl-Popup|             Popup window: body, default link |hl-Pmenu|
+|hl-PopupBorder|       Popup window: border characters, default link |hl-Pmenu|
+|hl-PopupTitle|                Popup window: title, default link |hl-Pmenu|
 |hl-PreInsert|         highlighting for completion preinserted text
 |hl-TabPanel|          |tabpanel|: not active tab page label
 |hl-TabPanelFill|      |tabpanel|: filler space
@@ -52690,6 +52693,9 @@ Options: ~
 Highlighting: ~
 
 |hl-VertSplitNC|       Column separator of non-current window.
+|hl-Popup|             Popup window body.
+|hl-PopupBorder|       Popup window border.
+|hl-PopupTitle|                Popup window title.
 
 ==============================================================================
 PATCHES                                                *patches-9.3* *bug-fixes-9.3*
index 1cf3b9940e3ad2dec51f4b2e26af381bcb15754e..f6b137f5215e6c81dd7cb73511946376e4aac05c 100644 (file)
@@ -2,7 +2,7 @@
 " Language:       Vim script
 " Maintainer:     Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "         Doug Kearns <dougkearns@gmail.com>
-" Last Change:    2026 May 10
+" Last Change:    2026 May 17
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -146,8 +146,8 @@ syn keyword vimGroup contained Added Bold BoldItalic Boolean Changed Character C
 
 " Default highlighting groups {{{2
 " GEN_SYN_VIM: vimHLGroup, START_STR='syn keyword vimHLGroup contained', END_STR=''
-syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit VertSplitNC VisualNOS DiffText DiffTextAdd PmenuSbar TabLineSel TabLineFill TabPanel TabPanelSel TabPanelFill Cursor lCursor TitleBar TitleBarNC QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuMatch PmenuMatchSel PmenuExtra PmenuExtraSel PmenuBorder PopupSelected MessageWindow PopupNotification PreInsert Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb PmenuShadow Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn MatchParen StatusLineTerm StatusLineTermNC
-syn keyword vimHLGroup contained ToolbarLine ToolbarButton TitleBar TitleBarNC Menu Tooltip Scrollbar CursorIM ComplMatchIns LineNrAbove LineNrBelow MsgArea Terminal User1 User2 User3 User4 User5 User6 User7 User8 User9
+syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit VertSplitNC VisualNOS DiffText DiffTextAdd PmenuSbar TabLineSel TabLineFill TabPanel TabPanelSel TabPanelFill Cursor lCursor TitleBar TitleBarNC QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuMatch PmenuMatchSel PmenuExtra PmenuExtraSel PmenuBorder PopupSelected Popup PopupBorder PopupTitle MessageWindow PopupNotification PreInsert Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb PmenuShadow Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn MatchParen
+syn keyword vimHLGroup contained StatusLineTerm StatusLineTermNC ToolbarLine ToolbarButton TitleBar TitleBarNC Menu Tooltip Scrollbar CursorIM ComplMatchIns LineNrAbove LineNrBelow MsgArea Terminal User1 User2 User3 User4 User5 User6 User7 User8 User9
 syn match vimHLGroup contained "\<Conceal\>"
 syn case match
 
index b21e489e617054071eec018bb65eaf5832741b51..3b1886be0ec552134e6dc968104742f3051143c5 100644 (file)
@@ -312,6 +312,9 @@ static char *(highlight_init_both[]) = {
     "default link PmenuExtraSel PmenuSel",
     "default link PmenuBorder Pmenu",
     "default link PopupSelected PmenuSel",
+    "default link Popup Pmenu",
+    "default link PopupBorder Pmenu",
+    "default link PopupTitle Pmenu",
     "default link MessageWindow WarningMsg",
     "default link PopupNotification WarningMsg",
     "default link PreInsert Added",
index afcaf9631995fd1ea0798347dddea3b8a536277c..af556569e3e2f117ff11be2445126c49b3347774 100644 (file)
@@ -313,7 +313,7 @@ struct vimoption
 # define ISP_LATIN1 (char_u *)"@,161-255"
 #endif
 
-#define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,y:CurSearch,m:MoreMsg,M:ModeMsg,n:LineNr,a:LineNrAbove,b:LineNrBelow,N:CursorLineNr,G:CursorLineSign,O:CursorLineFold,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,|:VertSplitNC,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,E:DiffTextAdd,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,k:PmenuMatch,<:PmenuMatchSel,[:PmenuKind,]:PmenuKindSel,{:PmenuExtra,}:PmenuExtraSel,x:PmenuSbar,X:PmenuThumb,j:PmenuBorder,H:PmenuShadow,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,z:StatusLineTerm,Z:StatusLineTermNC,g:MsgArea,h:ComplMatchIns,%:TabPanel,^:TabPanelSel,&:TabPanelFill,I:PreInsert"
+#define HIGHLIGHT_INIT "8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,y:CurSearch,m:MoreMsg,M:ModeMsg,n:LineNr,a:LineNrAbove,b:LineNrBelow,N:CursorLineNr,G:CursorLineSign,O:CursorLineFold,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,|:VertSplitNC,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,E:DiffTextAdd,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,k:PmenuMatch,<:PmenuMatchSel,[:PmenuKind,]:PmenuKindSel,{:PmenuExtra,}:PmenuExtraSel,x:PmenuSbar,X:PmenuThumb,j:PmenuBorder,H:PmenuShadow,p:Popup,J:PopupBorder,Q:PopupTitle,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine,z:StatusLineTerm,Z:StatusLineTermNC,g:MsgArea,h:ComplMatchIns,%:TabPanel,^:TabPanelSel,&:TabPanelFill,I:PreInsert"
 
 // Default python version for pyx* commands
 #if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3)
index f122d7a0de0e9178774fd886d09124905ed8c2c8..624e20c61395c80662ef7ff56b1538957cc7e21b 100644 (file)
@@ -6253,9 +6253,13 @@ update_popups(void (*win_update)(win_T *wp))
 
        for (i = 0; i < 4; ++i)
        {
-           border_attr[i] = popup_attr;
            if (wp->w_border_highlight[i] != NULL)
                border_attr[i] = syn_name2attr(wp->w_border_highlight[i]);
+           else if (wp->w_hlfwin_id != 0
+                                      || (wp->w_popup_flags & POPF_INFO))
+               border_attr[i] = popup_attr;
+           else
+               border_attr[i] = HL_ATTR(HLF_POPB);
 
            // Apply blend to border attributes for popup with opacitys
            if ((wp->w_popup_flags & POPF_OPACITY) && wp->w_popup_blend > 0)
@@ -6272,6 +6276,16 @@ update_popups(void (*win_update)(win_T *wp))
        title_wincol = wp->w_wincol + 1;
        if (wp->w_popup_title != NULL)
        {
+           int     title_attr;
+
+           if (wp->w_popup_border[0] > 0 && wp->w_border_highlight[0] != NULL)
+               title_attr = border_attr[0];
+           else if (wp->w_hlfwin_id != 0
+                                      || (wp->w_popup_flags & POPF_INFO))
+               title_attr = popup_attr;
+           else
+               title_attr = HL_ATTR(HLF_POPT);
+
            title_len = vim_strsize(wp->w_popup_title);
 
            // truncate the title if too long
@@ -6285,8 +6299,7 @@ update_popups(void (*win_update)(win_T *wp))
                    trunc_string(wp->w_popup_title, title_text,
                                          total_width - 2, title_byte_len + 1);
                    screen_puts(title_text, wp->w_winrow, title_wincol,
-                                 wp->w_popup_border[0] > 0
-                                               ? border_attr[0] : popup_attr);
+                                                                  title_attr);
                    vim_free(title_text);
                }
 
@@ -6294,7 +6307,7 @@ update_popups(void (*win_update)(win_T *wp))
            }
            else
                screen_puts(wp->w_popup_title, wp->w_winrow, title_wincol,
-                     wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr);
+                                                                  title_attr);
        }
 
        wincol = wp->w_wincol - wp->w_popup_leftoff + wp->w_popup_leftclip;
index 9c76b8763b387bb071e4a9976b9d7ae986a8c331..8c1b8da0a723e9ea05f2d552dac8803d8799a8f8 100644 (file)
@@ -134,7 +134,7 @@ get_win_attr(win_T *wp)
        if (wp->w_popup_flags & POPF_INFO)
            win_attr = HL_ATTR(HLF_PSI);    // PmenuSel
        else
-           win_attr = HL_ATTR(HLF_PNI);    // Pmenu
+           win_attr = HL_ATTR(HLF_POP);    // Popup
     }
 #endif
 
index 7ce2e9a2e8bf91b0f7ee07e005995f2f88728a31..36aee04f9ddbc168bb5436d3ffa2239247574899 100644 (file)
@@ -821,6 +821,8 @@ endfunc
 " Test for 'highlight' option
 func Test_highlight_opt()
   let save_hl = &highlight
+  " "K" is intentionally an unused 'highlight' flag character; if you add a
+  " new HLF_ entry, pick a different letter or update this test.
   call assert_fails('set highlight=K:b', 'E474:')
   set highlight=f\ r
   call assert_equal('f r', &highlight)
@@ -1622,7 +1624,7 @@ func Test_winhighlight_popupwin()
   hi B ctermbg=blue ctermfg=white
 
   redraw! # Remove intro message
-  win_execute(g:id, "set filetype=c whl=Pmenu:A,cType:B")
+  win_execute(g:id, "set filetype=c whl=Popup:A,PopupBorder:A,cType:B")
   END
   call writefile(lines, 'Xtest_winhighlight_popupwin', 'D')
 
index 501e951ab234f6ded541555dab8fd043c5e357a8..82e24f7d127c9f3bbaf4fc8fca82d08027b550a0 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    493,
 /**/
     492,
 /**/
index 25c81f2f8b951baf614a32ea5022b2a7ae10d46b..683aff2b7585dc71c1e623e14a09e4e29d32889f 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1568,6 +1568,9 @@ typedef enum
     , HLF_PST      // popup menu scrollbar thumb
     , HLF_PMB      // popup menu border
     , HLF_PMS      // popup menu shadow
+    , HLF_POP      // popup window body
+    , HLF_POPB     // popup window border
+    , HLF_POPT     // popup window title
     , HLF_TP       // tabpage line
     , HLF_TPS      // tabpage line selected
     , HLF_TPF      // tabpage line filler
@@ -1593,6 +1596,7 @@ typedef enum
                  'w', 'W', 'f', 'F', 'A', 'C', 'D', 'T', 'E', '-', '>', \
                  'B', 'P', 'R', 'L', \
                  '+', '=', 'k', '<','[', ']', '{', '}', 'x', 'X', 'j', 'H', \
+                 'p', 'J', 'Q', \
                  '*', '#', '_', '!', '.', 'o', 'q', \
                  'z', 'Z', 'g', \
                  '%', '^', '&', 'I', '('}