diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-16 15:43:21 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-16 15:43:21 +0200 |
commit | 05eb5b9cae123b138bbd23cc77e50657ece6b4ad (patch) | |
tree | c5edd589c1d36fbeeb23a24f077851d0ff8c7108 /src/testdir/test_highlight.vim | |
parent | fb489af2ec1b181d212a8aa8151d7784b260d01b (diff) |
patch 8.2.1693: "hi def" does not work for cleared highlightv8.2.1693
Problem: "hi def" does not work for cleared highlight.
Solution: Check the "sg_cleared" flag. (Maxim Kim, closes #6956,
closes #4405)
Diffstat (limited to 'src/testdir/test_highlight.vim')
-rw-r--r-- | src/testdir/test_highlight.vim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim index 4f2e238e45..5db2c57cb8 100644 --- a/src/testdir/test_highlight.vim +++ b/src/testdir/test_highlight.vim @@ -832,4 +832,36 @@ func Test_highlight_term_attr() hi clear endfunc +" Test default highlighting is restored +func Test_highlight_restore_defaults() + hi! link TestLink Identifier + hi! TestHi ctermbg=red + + let hlTestLinkPre = HighlightArgs('TestLink') + let hlTestHiPre = HighlightArgs('TestHi') + + " Test colorscheme + hi clear + if exists('syntax_on') + syntax reset + endif + let g:colors_name = 'test' + hi! link TestLink ErrorMsg + hi! TestHi ctermbg=green + + " Restore default highlighting + colorscheme default + syntax on + " 'default' should work no matter if highlight group was cleared + hi def link TestLink Identifier + hi def TestHi ctermbg=red + + let hlTestLinkPost = HighlightArgs('TestLink') + let hlTestHiPost = HighlightArgs('TestHi') + + call assert_equal(hlTestLinkPre, hlTestLinkPost) + call assert_equal(hlTestHiPre, hlTestHiPost) + hi clear +endfunc + " vim: shiftwidth=2 sts=2 expandtab |