diff src/popupwin.c @ 17077:2546930657a9 v8.1.1538

patch 8.1.1538: cannot specify highlighting for notifications commit https://github.com/vim/vim/commit/dfa97f2aed3d8ca195d09e2ce91cef227f933961 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 15 14:31:55 2019 +0200 patch 8.1.1538: cannot specify highlighting for notifications Problem: Cannot specify highlighting for notifications. Solution: Use the PopupNotification group if it exists. Add a minimal width to notifications.
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Jun 2019 14:45:05 +0200
parents dacd46fbaa90
children 94007c802045
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -258,7 +258,9 @@ apply_options(win_T *wp, buf_T *buf UNUS
     dictitem_T	*di;
     int		i;
 
-    wp->w_minwidth = dict_get_number(dict, (char_u *)"minwidth");
+    di = dict_find(dict, (char_u *)"minwidth", -1);
+    if (di != NULL)
+	wp->w_minwidth = dict_get_number(dict, (char_u *)"minwidth");
     wp->w_minheight = dict_get_number(dict, (char_u *)"minheight");
     wp->w_maxwidth = dict_get_number(dict, (char_u *)"maxwidth");
     wp->w_maxheight = dict_get_number(dict, (char_u *)"maxheight");
@@ -856,13 +858,17 @@ popup_create(typval_T *argvars, typval_T
 
 	wp->w_wantcol = 10;
 	wp->w_zindex = POPUPWIN_NOTIFICATION_ZINDEX;
+	wp->w_minwidth = 20;
+	wp->w_popup_drag = 1;
 	for (i = 0; i < 4; ++i)
 	    wp->w_popup_border[i] = 1;
 	wp->w_popup_padding[1] = 1;
 	wp->w_popup_padding[3] = 1;
+
+	nr = syn_name2id((char_u *)"PopupNotification");
 	set_string_option_direct_in_win(wp, (char_u *)"wincolor", -1,
-				(char_u *)"WarningMsg", OPT_FREE|OPT_LOCAL, 0);
-	wp->w_popup_drag = 1;
+		(char_u *)(nr == 0 ? "WarningMsg" : "PopupNotification"),
+		OPT_FREE|OPT_LOCAL, 0);
     }
 
     // Deal with options.