From 9a6e21e44d8423e656c32bb9f40a41dd8a6bb500 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sun, 2 Oct 2011 22:39:39 +1300 Subject: [PATCH] Don't highlight the same tag again, closes #36 --- autoload/tagbar.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 794c3b2..1d43683 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -90,6 +90,8 @@ let s:access_symbols = { let g:loaded_tagbar = 1 +let s:last_highlight_tline = 0 + " s:InitTypes() {{{2 function! s:InitTypes() let s:known_types = {} @@ -2059,6 +2061,9 @@ function! s:RenderContent(...) " window by jumping to the top after drawing execute 1 call winline() + + " Invalidate highlight cache from old file + let s:last_highlight_tline = 0 endif let &lazyredraw = lazyredraw_save @@ -2235,6 +2240,15 @@ function! s:HighlightTag() let tagline = tag.tline endif + " Don't highlight the tag again if it's the same one as last time. + " This prevents the Tagbar window from jumping back after scrolling with + " the mouse. + if tagline == s:last_highlight_tline + return + else + let s:last_highlight_tline = tagline + endif + let eventignore_save = &eventignore set eventignore=all