To: vim_dev@googlegroups.com Subject: Patch 9.0.0343 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0343 Problem: ColorScheme autocommand triggered when colorscheme is not found. (Romain Lafourcade) Solution: Only trigger ColorScheme when loading the colorscheme succeeds. (closes #11024) Files: src/highlight.c, src/testdir/test_gui.vim *** ../vim-9.0.0342/src/highlight.c 2022-08-31 14:46:07.911016920 +0100 --- src/highlight.c 2022-08-31 21:15:39.329667656 +0100 *************** *** 507,513 **** 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); } recursive = FALSE; --- 507,515 ---- sprintf((char *)buf, "colors/%s.vim", name); retval = source_runtime(buf, DIP_START + DIP_OPT); vim_free(buf); ! if (retval == OK) ! apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, ! FALSE, curbuf); } recursive = FALSE; *** ../vim-9.0.0342/src/testdir/test_gui.vim 2022-08-29 22:31:15.919685279 +0100 --- src/testdir/test_gui.vim 2022-08-31 21:14:49.117651862 +0100 *************** *** 36,43 **** let g:color_count = 0 augroup TestColors au! ! au ColorScheme * let g:color_count += 1| let g:after_colors = g:color_count ! au ColorSchemePre * let g:color_count += 1 |let g:before_colors = g:color_count augroup END colorscheme torte --- 36,47 ---- let g:color_count = 0 augroup TestColors au! ! au ColorScheme * let g:color_count += 1 ! \ | let g:after_colors = g:color_count ! \ | let g:color_after = expand('') ! au ColorSchemePre * let g:color_count += 1 ! \ | let g:before_colors = g:color_count ! \ | let g:color_pre = expand('') augroup END colorscheme torte *************** *** 45,50 **** --- 49,56 ---- call assert_equal('dark', &background) call assert_equal(1, g:before_colors) call assert_equal(2, g:after_colors) + call assert_equal('torte', g:color_pre) + call assert_equal('torte', g:color_after) call assert_equal("\ntorte", execute('colorscheme')) let a = substitute(execute('hi Search'), "\n\\s\\+", ' ', 'g') *************** *** 53,58 **** --- 59,66 ---- call assert_match("\nSearch xxx term=reverse ", a) call assert_fails('colorscheme does_not_exist', 'E185:') + call assert_equal('does_not_exist', g:color_pre) + call assert_equal('torte', g:color_after) exec 'colorscheme' colorscheme_saved augroup TestColors *** ../vim-9.0.0342/src/version.c 2022-08-31 17:48:05.715547588 +0100 --- src/version.c 2022-08-31 21:16:39.961686988 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 343, /**/ -- ARTHUR: Be quiet! I order you to shut up. OLD WOMAN: Order, eh -- who does he think he is? ARTHUR: I am your king! OLD WOMAN: Well, I didn't vote for you. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///