diff src/gui.c @ 31992:a509eb37a813 v9.0.1328

patch 9.0.1328: error when using "none" for GUI color is confusing Commit: https://github.com/vim/vim/commit/5b9f57262fdadf460e6355abf1eee95b4f96abe8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 19 20:49:38 2023 +0000 patch 9.0.1328: error when using "none" for GUI color is confusing Problem: Error when using "none" for GUI color is confusing. Solution: Mention that the name should perhaps be "NONE". (closes https://github.com/vim/vim/issues/1400)
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Feb 2023 22:00:03 +0100
parents e5ee2ffd826a
children b2cce50602ca
line wrap: on
line diff
--- a/src/gui.c
+++ b/src/gui.c
@@ -4634,12 +4634,18 @@ gui_get_color(char_u *name)
 	return INVALCOLOR;
     t = gui_mch_get_color(name);
 
+    int is_none = STRCMP(name, "none") == 0;
     if (t == INVALCOLOR
 #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
-	    && gui.in_use
+	    && (gui.in_use || is_none)
 #endif
 	    )
-	semsg(_(e_cannot_allocate_color_str), name);
+    {
+	if (is_none)
+	    emsg(_(e_cannot_use_color_none_did_you_mean_none));
+	else
+	    semsg(_(e_cannot_allocate_color_str), name);
+    }
     return t;
 }