From a09e085b511b370284c2f4514a092133a902b2ee Mon Sep 17 00:00:00 2001 From: Lewis Franklin Date: Tue, 12 Mar 2013 16:19:50 +0100 Subject: [PATCH] Prevent infinite loop on Windows gVim. --- plugin/gitgutter.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugin/gitgutter.vim b/plugin/gitgutter.vim index df18f11..b0e2e18 100644 --- a/plugin/gitgutter.vim +++ b/plugin/gitgutter.vim @@ -12,6 +12,10 @@ endif if !exists('g:gitgutter_highlight_lines') let g:gitgutter_highlight_lines = 0 endif + +if !exists('g:gitgutter_force_focusgained') + let g:gitgutter_force_focusgained = 0 +endif let s:highlight_lines = g:gitgutter_highlight_lines function! s:init() @@ -284,6 +288,10 @@ function! s:process_modified_and_removed(modifications, from_count, to_count, to call add(a:modifications, [a:to_line + offset - 1, 'modified_removed']) endfunction + +function! s:is_gvim_on_windows() + return has("gui_running") && (has("win16") || has("win32") || has("win64")) +endfunction " }}} " Sign processing {{{ @@ -464,7 +472,10 @@ endfunction augroup gitgutter autocmd! - autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost,FocusGained * call GitGutter() + autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost * call GitGutter() + if !s:is_gvim_on_windows() || g:gitgutter_force_focusgained + autocmd FocusGained * call GitGutter() + endif augroup END " }}}