#1875 Do not lint and so on when an operator is pending

This commit is contained in:
w0rp 2018-09-03 13:59:56 +01:00
parent a746ea2bfc
commit fddbfdef12
No known key found for this signature in database
GPG key ID: 0FC1ECAA8C81CD83
2 changed files with 22 additions and 1 deletions

View file

@ -62,6 +62,11 @@ function! ale#ShouldDoNothing(buffer) abort
return 1
endif
" Don't start linting and so on when an operator is pending.
if ale#util#Mode(1) is# 'no'
return 1
endif
" Do nothing if running in the sandbox.
if ale#util#InSandbox()
return 1

View file

@ -4,10 +4,18 @@ Before:
Save g:ale_enabled
Save &l:statusline
let b:fake_mode = 'n'
call ale#test#SetDirectory('/testplugin/test')
let b:funky_command_created = 0
runtime autoload/ale/util.vim
function! ale#util#Mode(...) abort
return b:fake_mode
endfunction
" We will test for the existence of this command, so create one if needed.
if !exists(':CtrlPFunky')
command CtrlPFunky echo
@ -25,6 +33,9 @@ After:
endif
unlet! b:funky_command_created
unlet! b:fake_mode
runtime autoload/ale/util.vim
Given foobar(An empty file):
Execute(ALE shouldn't do much of anything for ctrlp-funky buffers):
@ -44,7 +55,7 @@ Execute(ALE shouldn't try to check buffers with '.' as the filename):
Assert ale#ShouldDoNothing(bufnr(''))
Execute(DoNothing should return 0 when the filetype is empty):
Execute(DoNothing should return 1 when the filetype is empty):
AssertEqual
\ 0,
\ ale#ShouldDoNothing(bufnr('')),
@ -54,6 +65,11 @@ Execute(DoNothing should return 0 when the filetype is empty):
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
Execute(DoNothing should return 1 when an operator is pending):
let b:fake_mode = 'no'
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