patch 9.0.0343: ColorScheme autocommand triggered when colorscheme not found
Problem: ColorScheme autocommand triggered when colorscheme is not found.
(Romain Lafourcade)
Solution: Only trigger ColorScheme when loading the colorscheme succeeds.
(closes #11024)
diff --git a/src/highlight.c b/src/highlight.c
index 95cdb46..303d5c2 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -507,7 +507,9 @@
sprintf((char *)buf, "colors/%s.vim", name);
retval = source_runtime(buf, DIP_START + DIP_OPT);
vim_free(buf);
- apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf);
+ if (retval == OK)
+ apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname,
+ FALSE, curbuf);
}
recursive = FALSE;