From a532d7c4454c9271e674375b7a8246541ee5f898 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Fri, 4 Mar 2011 02:59:40 +1300 Subject: [PATCH] Make sure the whole Tagbar content is shown if it is shorter than the window height --- plugin/tagbar.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index 6adf52e..47772ab 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -1619,12 +1619,23 @@ function! s:HighlightTag(fname) " No tag above cursor position so don't do anything if tagline == 0 + if line('$') < winheight(0) - 1 + execute 1 + call winline() + endif execute prevwinnr . 'wincmd w' let &eventignore = eventignore_save redraw return endif + " If the Tagbar contents are shorter than the window height make sure + " that the whole content is shown by jumping to the top of the window + if line('$') < winheight(0) - 1 + execute 1 + call winline() + endif + " Go to the line containing the tag execute tagline