From 791990610543b8b292457096d2a5ad45d8489649 Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Wed, 8 Jan 2014 09:40:16 +0100 Subject: [PATCH] Fix bug that processed buffers it shouldn't have. All processing logic should be guarded by `utility#is_active()`. --- plugin/gitgutter.vim | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index 537fce5..3efbb43 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -54,10 +54,9 @@ command GitGutterAll call GitGutterAll() " fresh_changes: (boolean) when truthy, only process if there are buffer changes " since the last gitgutter process; otherwise always process. 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) - if utility#is_active() + call utility#set_file(a:file) + 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) let diff = diff#run_diff(1) else @@ -75,11 +74,10 @@ function! GitGutter(file, realtime, fresh_changes) endif endif call sign#update_signs(a:file, modified_lines) - else - call hunk#reset() + call setbufvar(a:file, 'gitgutter_last_tick', getbufvar(a:file, 'changedtick')) endif - - call setbufvar(a:file, 'gitgutter_last_tick', getbufvar(a:file, 'changedtick')) + else + call hunk#reset() endif endfunction command GitGutter call GitGutter(utility#current_file(), 0, 0)