diff options
-rw-r--r-- | autoload/xolox/easytags.vim | 16 | ||||
-rw-r--r-- | plugin/easytags.vim | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim index 6a1de96..bbea4dc 100644 --- a/autoload/xolox/easytags.vim +++ b/autoload/xolox/easytags.vim @@ -389,23 +389,33 @@ function! xolox#easytags#read_tagsfile(tagsfile) " {{{2 " otherwise Vim might complain with "E432: Tags file not sorted". let headers = [] let entries = [] + let num_invalid = 0 for line in readfile(a:tagsfile) if line =~# '^!_TAG_' call add(headers, line) else - call add(entries, xolox#easytags#parse_entry(line)) + let entry = xolox#easytags#parse_entry(line) + if !empty(entry) + call add(entries, entry) + else + let num_invalid += 1 + endif endif endfor + if num_invalid > 0 + call xolox#misc#msg#warn("easytags.vim %s: Ignored %i invalid line(s) in %s!", g:easytags_version, num_invalid, a:tagsfile) + endif return [headers, entries] endfunction function! xolox#easytags#parse_entry(line) " {{{2 - return matchlist(a:line, '^\([^\t]\+\)\t\([^\t]\+\)\t\(.\+\)$')[1:3] + let fields = split(a:line, '\t') + return len(fields) >= 3 ? fields : [] endfunction function! xolox#easytags#parse_entries(lines) " {{{2 call map(a:lines, 'xolox#easytags#parse_entry(v:val)') - return a:lines + return filter(a:lines, '!empty(v:val)') endfunction function! xolox#easytags#write_tagsfile(tagsfile, headers, entries) " {{{2 diff --git a/plugin/easytags.vim b/plugin/easytags.vim index 7590dcd..6e357c9 100644 --- a/plugin/easytags.vim +++ b/plugin/easytags.vim @@ -12,7 +12,7 @@ if &cp || exists('g:loaded_easytags') finish endif -let g:easytags_version = '2.4.4' +let g:easytags_version = '2.4.5' " Configuration defaults and initialization. {{{1 |