Skip to content

Commit

Permalink
Always prevent flicker.
Browse files Browse the repository at this point in the history
Previously flicker was prevented only when the sign column was
always present.
  • Loading branch information
airblade committed Apr 10, 2013
1 parent fe1a769 commit d4a1a60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 0 additions & 4 deletions README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,6 @@ Note that this is always off with gVim on Windows due to a Vim/shell bug causing
Your colorscheme is configuring the `SignColumn` highlight group weirdly. Please see the section above on customising the sign column.

> Why does the window flicker when the signs are redrawn?
This happens on certain combinations of OS and Vim. You can prevent the flicker by adding `let g:gitgutter_sign_column_always = 1` to your `~/.vimrc`.

> There's a noticeable lag when vim-gitter runs; how can I avoid it?
By default vim-gitgutter runs often so the signs are as accurate as possible. However on some systems this causes a noticeable lag. If you would like to trade a little accuracy for speed, add one or both of these to your `~/.vimrc`:
Expand Down
10 changes: 10 additions & 0 deletions plugin/gitgutter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ function! s:is_tracked_by_git()
return !v:shell_error
endfunction

function! s:differences(hunks)
return len(a:hunks) != 0
endfunction

function! s:snake_case_to_camel_case(text)
return substitute(a:text, '\v(.)(\a+)(_(.)(.+))?', '\u\1\l\2\u\4\l\5', '')
endfunction
Expand Down Expand Up @@ -417,6 +421,12 @@ function! GitGutter(file)
let modified_lines = s:process_hunks(s:hunks)
if g:gitgutter_sign_column_always
call s:add_dummy_sign()
else
if s:differences(s:hunks)
call s:add_dummy_sign() " prevent flicker
else
call s:remove_dummy_sign()
endif
endif
call s:clear_signs(a:file)
call s:find_other_signs(a:file)
Expand Down

0 comments on commit d4a1a60

Please sign in to comment.