Use processed-dict, uniq() might not be available

This commit is contained in:
Daniel Hahler
2018-02-21 00:42:30 +01:00
committed by Andy Stewart
parent 6c2def1075
commit d78184e646

View File

@@ -3,7 +3,12 @@ let s:t_string = type('')
" Primary functions {{{
function! gitgutter#all(force) abort
for bufnr in uniq(sort(tabpagebuflist()))
let processed = {}
for bufnr in tabpagebuflist()
if has_key(processed, bufnr)
continue
endif
let processed[bufnr] = 1
let file = expand('#'.bufnr.':p')
if !empty(file)
call gitgutter#init_buffer(bufnr)
@@ -57,9 +62,13 @@ function! gitgutter#disable() abort
for i in range(tabpagenr('$'))
call extend(buflist, tabpagebuflist(i + 1))
endfor
call uniq(sort(buflist))
let processed = {}
for bufnr in buflist
if has_key(processed, bufnr)
continue
endif
let processed[bufnr] = 1
let file = expand('#'.bufnr.':p')
if !empty(file)
call s:clear(bufnr)