airblade/vim-gitgutter — pull request #177 by TiddoLangerak (2014-06-10 16:32:05+00:00)
Title: Fix glitches when updatetime is low

I have been able to reproduce the glitching problem (see #102) with this plugin consistently by doing `set ut=`. By default `ut` (updatetime) is set to 4000ms which doesn't cause any glitches (at least not on my system), but some plugins may set it to a different value (for me it was [vim-css-color](http://github.com/skammer/vim-css-color) that did so).

I have tested this with all other plugins disabled, and I was able to consistently trigger these glitches by setting ut to some low value (100 or lower did the trick for me) and typing relatively fast. This apparently causes `gitgutter#process_buffer` to be called in such rapid succession that a new call is already being done while the previous is still being processed.

Fortunately the fix seems relatively easy: by toggling a flag we can guarantee that `process_buffer` is never actually executed when the previous call has not yet returned. For me this fixed the issue.