From 091f6336c828986ac0a1403e7720e91e7afe130e Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Tue, 28 Feb 2012 22:46:04 +1300 Subject: [PATCH] Save some unnecessary redrawings --- autoload/tagbar.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index f96eccc..3adfd80 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -2860,6 +2860,8 @@ function! s:AutoUpdate(fname) return endif + let updated = 0 + " Process the file if it's unknown or the information is outdated " Also test for entries that exist but are empty, which will be the case " if there was an error during the ctags execution @@ -2867,10 +2869,12 @@ function! s:AutoUpdate(fname) if s:known_files.get(a:fname).mtime != getftime(a:fname) call s:LogDebugMessage('File data outdated, updating ' . a:fname) call s:ProcessFile(a:fname, sftype) + let updated = 1 endif elseif !s:known_files.has(a:fname) call s:LogDebugMessage('New file, processing ' . a:fname) call s:ProcessFile(a:fname, sftype) + let updated = 1 endif let fileinfo = s:known_files.get(a:fname) @@ -2882,8 +2886,11 @@ function! s:AutoUpdate(fname) return endif - " Display the tagbar content - call s:RenderContent(fileinfo) + " Display the tagbar content if the tags have been updated or a different + " file is being displayed + if updated || a:fname != s:known_files.getCurrent().fpath + call s:RenderContent(fileinfo) + endif " Call setCurrent after rendering so RenderContent can check whether the " same file is redisplayed