From 52ebe34eebf361f28b1a374399cd7e3d8201bfb2 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 21 Jun 2018 05:15:11 -0400 Subject: vim-patch:8.0.0616: not always setting 'background' correctly after :hi Normal (#8606) Problem: When setting the cterm background with ":hi Normal" the value of 'background' may be set wrongly. Solution: Check that the color is less than 16. Don't set 'background' when it was set explicitly. (Lemonboy, closes vim/vim#1710) https://github.com/vim/vim/commit/1615b36b91b094263240d7b555283ddf33208f62 Restore reset_option_was_set(), removed in 419da839e0cbdf6251bc31dc218fa629ccc91b44 ref #8595 ref #8597 --- src/nvim/testdir/test_syntax.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/nvim/testdir/test_syntax.vim') diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim index ebdfc250aa..6d164ac895 100644 --- a/src/nvim/testdir/test_syntax.vim +++ b/src/nvim/testdir/test_syntax.vim @@ -435,3 +435,26 @@ func Test_conceal() bw! endfunc +func Test_bg_detection() + if has('gui_running') + return + endif + " auto-detection of &bg, make sure sure it isn't set anywhere before + " this test + hi Normal ctermbg=0 + call assert_equal('dark', &bg) + hi Normal ctermbg=4 + call assert_equal('dark', &bg) + hi Normal ctermbg=12 + call assert_equal('light', &bg) + hi Normal ctermbg=15 + call assert_equal('light', &bg) + + " manually-set &bg takes precendence over auto-detection + set bg=light + hi Normal ctermbg=4 + call assert_equal('light', &bg) + set bg=dark + hi Normal ctermbg=12 + call assert_equal('dark', &bg) +endfunc -- cgit