From bf8aae02e8a1a58649c4617008bd38b71b6b602d Mon Sep 17 00:00:00 2001 From: w0rp Date: Sat, 6 May 2017 16:20:39 +0100 Subject: Fix #534 - Stop other higlights being restored when buffers are hidden and shown again --- test/test_highlight_placement.vader | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader index 14c16328..e67bca01 100644 --- a/test/test_highlight_placement.vader +++ b/test/test_highlight_placement.vader @@ -28,12 +28,14 @@ Before: \ 'command': 'echo', \ 'callback': 'GenerateResults', \}) + highlight link SomeOtherGroup SpellBad After: delfunction GenerateResults call ale#linter#Reset() let g:ale_buffer_info = {} call clearmatches() + highlight clear SomeOtherGroup Given testft(A Javscript file with warnings/errors): foo @@ -107,3 +109,23 @@ Execute(Highlights should be cleared when buffers are hidden): call ale#highlight#UpdateHighlights() AssertEqual 1, len(getmatches()), 'The highlights weren''t set again!' + +Execute(Only ALE highlights should be restored when buffers are restored): + call ale#engine#InitBufferInfo(bufnr('%')) + call ale#highlight#SetHighlights(bufnr('%'), [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2}, + \]) + + call matchaddpos('SomeOtherGroup', [[1, 1, 1]]) + + " We should have one more match here. + AssertEqual 2, len(getmatches()), 'The highlights weren''t initially set!' + + call ale#highlight#BufferHidden(bufnr('%')) + + AssertEqual 0, len(getmatches()), 'The highlights weren''t cleared!' + + call ale#highlight#UpdateHighlights() + + " Only our matches should appear again. + AssertEqual 1, len(getmatches()), 'The highlights weren''t set again!' -- cgit v1.2.3