From 5d09a401ec393dc930e1104ceb38eab34681de64 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 31 Aug 2022 21:17:10 +0100 Subject: 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) --- src/highlight.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/highlight.c') diff --git a/src/highlight.c b/src/highlight.c index 95cdb46b5a..303d5c294f 100644 --- a/src/highlight.c +++ b/src/highlight.c @@ -507,7 +507,9 @@ load_colors(char_u *name) 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; -- cgit v1.2.3