Do not deactivate gitgutter when &diff is set.

In #303 there was a request to deactivate gitgutter when &diff is set,
although no reason was given initially.  Then it was reported that
gitgutter showed signs, in the wrong place, during Fugitive's Gdiff.

However I cannot reproduce signs showing in Gdiff's index buffer.  And
the signs in the working tree buffer are correct.

Furthermore the commit which deactivated gitgutter (85f6e136) had the
side-effect of breaking `:redir` and clearing Vim's startup message
(see #500).

Therefore since that change had no benefit, and a couple of drawbacks,
it makes sense to undo it.

Closes #500.
This commit is contained in:
Andy Stewart
2018-03-16 18:49:22 +00:00
parent be14ed7943
commit 37bdd03d17
2 changed files with 1 additions and 26 deletions

View File

@@ -45,8 +45,6 @@ function! gitgutter#process_buffer(bufnr, force) abort
endif
endif
else
call s:clear(a:bufnr)
endif
endfunction

View File

@@ -50,8 +50,7 @@ function! gitgutter#utility#is_active(bufnr) abort
\ !pumvisible() &&
\ s:is_file_buffer(a:bufnr) &&
\ s:exists_file(a:bufnr) &&
\ s:not_git_dir(a:bufnr) &&
\ !s:vimdiff(a:bufnr)
\ s:not_git_dir(a:bufnr)
endfunction
function! s:not_git_dir(bufnr) abort
@@ -206,28 +205,6 @@ function! s:strip_trailing_new_line(line) abort
return substitute(a:line, '\n$', '', '')
endfunction
" Returns 1 if any of the given buffer's windows has the `&diff` option set,
" or 0 otherwise.
if exists('*win_findbuf')
function! s:vimdiff(bufnr) abort
for winid in win_findbuf(a:bufnr)
if getwinvar(winid, '&diff')
return 1
endif
endfor
return 0
endfunction
else
function! s:vimdiff(bufnr) abort
for winnr in range(1, winnr('$'))
if winbufnr(winnr) == a:bufnr && getwinvar(winnr, '&diff')
return 1
endif
endfor
return 0
endfunction
endif
function! s:windows()
return has('win64') || has('win32') || has('win16')
endfunction