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>
diff --git a/src/highlight.c b/src/highlight.c
index 1a4c76d..8c1ad80 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -262,6 +262,9 @@
"default link PmenuMatchSel PmenuSel",
"default link PmenuExtra Pmenu",
"default link PmenuExtraSel PmenuSel",
+ "default link PopupSelected PmenuSel",
+ "default link MessageWindow WarningMsg",
+ "default link PopupNotification WarningMsg",
CENT("Normal cterm=NONE", "Normal gui=NONE"),
NULL
};
diff --git a/src/popupwin.c b/src/popupwin.c
index 4045490..c84c079 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -696,9 +696,6 @@
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 @@
{
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);
}
diff --git a/src/testdir/dumps/Test_popupwin_notify_02.dump b/src/testdir/dumps/Test_popupwin_notify_02.dump
index 72e2895..e25efdc 100644
--- a/src/testdir/dumps/Test_popupwin_notify_02.dump
+++ b/src/testdir/dumps/Test_popupwin_notify_02.dump
@@ -1,6 +1,6 @@
->1+0&#ffffff0| @7|╔+0#e000002&|═@21|╗| +0#0000000&@41
-|2| @7|║+0#e000002&| |f|i|r|s|t| |n|o|t|i|f|i|c|a|t|i|o|n| @2|║| +0#0000000&@41
-|3| @7|╚+0#e000002&|═@21|╝| +0#0000000&@41
+>1+0&#ffffff0| @7|╔+0fd7ff255|═@21|╗| +0&#ffffff0@41
+|2| @7|║+0fd7ff255| |f|i|r|s|t| |n|o|t|i|f|i|c|a|t|i|o|n| @2|║| +0&#ffffff0@41
+|3| @7|╚+0fd7ff255|═@21|╝| +0&#ffffff0@41
|4| @7|╔+0fd7ff255|═@31|╗| +0&#ffffff0@31
|5| @7|║+0fd7ff255| |a|n|o|t|h|e|r| |i|m|p|o|r|t|a|n|t| |n|o|t|i|f|i|c|a|t|i|o|n| |║| +0&#ffffff0@31
|6| @7|╚+0fd7ff255|═@31|╝| +0&#ffffff0@31
diff --git a/src/version.c b/src/version.c
index f400ca9..0e7e236 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1123,
+/**/
1122,
/**/
1121,