0
0
mirror of https://github.com/vim/vim.git synced 2025-10-30 09:47:20 -04:00

patch 9.1.1123: popup hi groups not falling back to defaults

Problem:  Highlight groups PopupSelected/PopupNotification/
          MessageWindow are supposed to fall back to default highlight
          groups if they are not defined. However, once a colorscheme
          has defined them, switching to another colorscheme that
          doesn't do so will leave behind a cleared colorscheme, which
          causes the fallback to fail.

Solution: Set up default links to the relevant fallback highlight
          groups, which makes sure a `:hi clear` command will reset the
          state properly (Yee Cheng Chin).

closes: #16676

Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yee Cheng Chin
2025-02-20 21:58:21 +01:00
committed by Christian Brabandt
parent 911742a975
commit e700ddeea4
7 changed files with 21 additions and 17 deletions

View File

@@ -696,9 +696,6 @@ popup_highlight_curline(win_T *wp)
if (!sign_exists_by_name(sign_name))
{
char *linehl = "PopupSelected";
if (syn_name2id((char_u *)linehl) == 0)
linehl = "PmenuSel";
sign_define_by_name(sign_name, NULL, (char_u *)linehl, NULL, NULL, NULL,
NULL, SIGN_DEF_PRIO);
}
@@ -2006,10 +2003,8 @@ popup_update_color(win_T *wp, create_type_T type)
{
char *hiname = type == TYPE_MESSAGE_WIN
? "MessageWindow" : "PopupNotification";
int nr = syn_name2id((char_u *)hiname);
set_string_option_direct_in_win(wp, (char_u *)"wincolor", -1,
(char_u *)(nr == 0 ? "WarningMsg" : hiname),
(char_u *)hiname,
OPT_FREE|OPT_LOCAL, 0);
}