summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-04-08 13:42:09 +0100
committerw0rp <devw0rp@gmail.com>2019-04-10 18:43:21 +0100
commit950204b133c469f3c6fcabc195141cc4181d6a46 (patch)
tree1032a0f682c3d17ecd1ac4a487579ba43df26b83
parentbbb6e703770e67d8d0e05b2144e4b1102092773e (diff)
downloadale-950204b133c469f3c6fcabc195141cc4181d6a46.zip
Fix #2399 - Do not check buffers used for displaying diffs
-rw-r--r--autoload/ale.vim5
-rw-r--r--test/test_should_do_nothing_conditions.vader9
2 files changed, 14 insertions, 0 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim
index cd106887..a887834b 100644
--- a/autoload/ale.vim
+++ b/autoload/ale.vim
@@ -43,6 +43,11 @@ function! ale#ShouldDoNothing(buffer) abort
return 1
endif
+ " Do nothing for diff buffers.
+ if getbufvar(a:buffer, '&diff')
+ return 1
+ endif
+
" Do nothing for blacklisted files.
if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0
return 1
diff --git a/test/test_should_do_nothing_conditions.vader b/test/test_should_do_nothing_conditions.vader
index de2e2782..6dfed555 100644
--- a/test/test_should_do_nothing_conditions.vader
+++ b/test/test_should_do_nothing_conditions.vader
@@ -35,6 +35,10 @@ After:
unlet! b:funky_command_created
unlet! b:fake_mode
+ if &diff is 1
+ let &diff = 0
+ endif
+
runtime autoload/ale/util.vim
Given foobar(An empty file):
@@ -70,6 +74,11 @@ Execute(DoNothing should return 1 when an operator is pending):
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
+Execute(DoNothing should return 1 for diff buffers):
+ let &diff = 1
+
+ AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
+
Execute(The DoNothing check should work if the ALE globals aren't defined):
unlet! g:ale_filetype_blacklist
unlet! g:ale_maximum_file_size