From 597a0f4940101a6a46ff3fbef699911ba7a2b954 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Tue, 18 Jan 2011 15:03:27 +1300 Subject: [PATCH] Fix some compatibility bugs --- plugin/tagbar.vim | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index f10fddb..a41fb3c 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -158,10 +158,13 @@ function! s:OpenWindow() setlocal filetype=tagbar setlocal nolist setlocal nonumber - setlocal norelativenumber setlocal nowrap setlocal winfixwidth + if exists('+relativenumber') + setlocal norelativenumber + endif + setlocal foldenable setlocal foldminlines=0 setlocal foldmethod=manual @@ -314,8 +317,11 @@ function! s:ProcessFile(fname, ftype) let fileinfo.tags = [] for line in rawtaglist - let taginfo = s:ParseTagline(line) - call add(fileinfo.tags, taginfo) + let parts = split(line, ';"') + if len(parts) == 2 " Is a valid tag line + let taginfo = s:ParseTagline(parts[0], parts[1]) + call add(fileinfo.tags, taginfo) + endif endfor " Script-local variable needed since compare functions can't @@ -352,18 +358,16 @@ endfunction " namefileexpattern;"fields " fields: name:value " fields that are always present: kind, line -function! s:ParseTagline(line) - let parts = split(a:line, ';"') - +function! s:ParseTagline(part1, part2) let taginfo = {} - let basic_info = split(parts[0], '\t') + let basic_info = split(a:part1, '\t') let taginfo.name = basic_info[0] let taginfo.file = basic_info[1] let taginfo.pattern = basic_info[2] let taginfo.fields = {} - let fields = split(parts[1], '\t') + let fields = split(a:part2, '\t') for field in fields " can't use split() since the value can contain ':' let delimit = stridx(field, ':')