diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 99e4e70a3a..1c1100a981 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -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) diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt index 2afa93a756..2e91244778 100644 --- a/runtime/doc/popup.txt +++ b/runtime/doc/popup.txt @@ -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 diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index c74f95e808..428e8a5522 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -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. diff --git a/runtime/doc/tags b/runtime/doc/tags index d5a8a1b30c..b94169f0f1 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -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* diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt index 5121fe90c6..5b4bb19906 100644 --- a/runtime/doc/version9.txt +++ b/runtime/doc/version9.txt @@ -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* diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 1cf3b9940e..f6b137f521 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -2,7 +2,7 @@ " Language: Vim script " Maintainer: Hirohito Higashi " Doug Kearns -" 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 "\" syn case match diff --git a/src/highlight.c b/src/highlight.c index b21e489e61..3b1886be0e 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -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", diff --git a/src/optiondefs.h b/src/optiondefs.h index afcaf96319..af556569e3 100644 --- a/src/optiondefs.h +++ b/src/optiondefs.h @@ -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) diff --git a/src/popupwin.c b/src/popupwin.c index f122d7a0de..624e20c613 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -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; diff --git a/src/screen.c b/src/screen.c index 9c76b8763b..8c1b8da0a7 100644 --- a/src/screen.c +++ b/src/screen.c @@ -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 diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim index 7ce2e9a2e8..36aee04f9d 100644 --- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -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') diff --git a/src/version.c b/src/version.c index 501e951ab2..82e24f7d12 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 */ +/**/ + 493, /**/ 492, /**/ diff --git a/src/vim.h b/src/vim.h index 25c81f2f8b..683aff2b75 100644 --- 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', '('}