mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 03:53:47 -05:00
Fix bug that processed buffers it shouldn't have.
All processing logic should be guarded by `utility#is_active()`.
This commit is contained in:
@@ -54,10 +54,9 @@ command GitGutterAll call GitGutterAll()
|
|||||||
" fresh_changes: (boolean) when truthy, only process if there are buffer changes
|
" fresh_changes: (boolean) when truthy, only process if there are buffer changes
|
||||||
" since the last gitgutter process; otherwise always process.
|
" since the last gitgutter process; otherwise always process.
|
||||||
function! GitGutter(file, realtime, fresh_changes)
|
function! GitGutter(file, realtime, fresh_changes)
|
||||||
if !a:fresh_changes || getbufvar(a:file, 'changedtick') != getbufvar(a:file, 'gitgutter_last_tick', -1)
|
|
||||||
|
|
||||||
call utility#set_file(a:file)
|
call utility#set_file(a:file)
|
||||||
if utility#is_active()
|
if utility#is_active()
|
||||||
|
if !a:fresh_changes || getbufvar(a:file, 'changedtick') != getbufvar(a:file, 'gitgutter_last_tick', -1)
|
||||||
if a:realtime || utility#has_unsaved_changes(a:file)
|
if a:realtime || utility#has_unsaved_changes(a:file)
|
||||||
let diff = diff#run_diff(1)
|
let diff = diff#run_diff(1)
|
||||||
else
|
else
|
||||||
@@ -75,12 +74,11 @@ function! GitGutter(file, realtime, fresh_changes)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
call sign#update_signs(a:file, modified_lines)
|
call sign#update_signs(a:file, modified_lines)
|
||||||
|
call setbufvar(a:file, 'gitgutter_last_tick', getbufvar(a:file, 'changedtick'))
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
call hunk#reset()
|
call hunk#reset()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call setbufvar(a:file, 'gitgutter_last_tick', getbufvar(a:file, 'changedtick'))
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
command GitGutter call GitGutter(utility#current_file(), 0, 0)
|
command GitGutter call GitGutter(utility#current_file(), 0, 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user