summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-06-04 21:06:09 +0200
committerBram Moolenaar <Bram@vim.org>2017-06-04 21:06:09 +0200
commit1615b36b91b094263240d7b555283ddf33208f62 (patch)
treed1b6b239f7e782080587529319455361c23fd11c /src/testdir
parentbf15b8d78b22661db8b19d662b62bb9a061cdd37 (diff)
downloadvim-1615b36b91b094263240d7b555283ddf33208f62.zip
patch 8.0.0616: not always setting 'background' correctly after :hi Normal
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 #1710)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_syntax.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/testdir/test_syntax.vim b/src/testdir/test_syntax.vim
index 8d4be00d3..eb093c8ff 100644
--- a/src/testdir/test_syntax.vim
+++ b/src/testdir/test_syntax.vim
@@ -401,3 +401,26 @@ func Test_highlight_invalid_arg()
call assert_fails('hi XXX xxx=White', 'E423:')
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