From 96275e3921bf10e09f113afbfc0445792d03d954 Mon Sep 17 00:00:00 2001 From: AdnoC Date: Sun, 30 Jul 2017 12:11:31 -0400 Subject: [PATCH] Reduce code dupication in ChangeFoldLevel --- autoload/tagbar.vim | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 787407b..4b74d46 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -3511,31 +3511,7 @@ function! s:ChangeFoldLevel(diff, force) abort let level = fileinfo.foldlevel let level = level + a:diff - if level < 0 - call s:warning('Foldlevel can''t be negative') - return - endif - - call s:SetFoldLevelRecursive(fileinfo, fileinfo.getTags(), level) - - let typeinfo = fileinfo.typeinfo - - " Apply foldlevel to 'kind's - if level == 0 - for kind in typeinfo.kinds - call fileinfo.closeKindFold(kind) - endfor - else - for kind in typeinfo.kinds - if a:force || !kind.fold - call fileinfo.openKindFold(kind) - endif - endfor - endif - - let fileinfo.foldlevel = level - - call s:RenderContent() + call s:SetFoldLevel(level, a:force) endfunction " s:SetFoldLevel() {{{2