From 81c2772905fc68396b5ca135735ff984c7c582cc Mon Sep 17 00:00:00 2001 From: David Beniamine Date: Thu, 17 Dec 2015 23:23:10 +0100 Subject: [PATCH] Add debug info in hierarchical sort ADD: Debug info needed for solving issue #5 FIX: Incomplete group detection in hierarchical sort (should not impact issue #5) --- autoload/todo.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/autoload/todo.vim b/autoload/todo.vim index e177f51..e1e0177 100644 --- a/autoload/todo.vim +++ b/autoload/todo.vim @@ -190,9 +190,17 @@ function! todo#HierarchicalSort(symbol, symbolsub, dolastsort) let l:position= todo#GetCurpos() execute "silent normal g\" let l:linecount=str2nr(split(v:statusmsg)[7]) + if(exists("g:Todo_txt_debug")) + echo "Linescount: ".l:linecount + endif " Get all the groups names let l:groups=GetGroups(a:symbol,1,l:linecount) + if(exists("g:Todo_txt_debug")) + echo "Groups: " + echo l:groups + echo 'execute sort'.l:sortmode.' /.\{-}\ze'.a:symbol.'/' + endif " Sort by groups execute 'sort'.l:sortmode.' /.\{-}\ze'.a:symbol.'/' for l:g in l:groups @@ -225,6 +233,9 @@ function! todo#HierarchicalSort(symbol, symbolsub, dolastsort) endfor else " Sort by priority + if(exists("g:Todo_txt_debug")) + echo 'execute '.l:groupBegin.','.l:groupEnd.'sort'.l:sortmodefinal + endif execute l:groupBegin.','.l:groupEnd.'sort'.l:sortmodefinal endif endif @@ -239,7 +250,7 @@ function! GetGroups(symbol,begin, end) let l:curline=a:begin let l:groups=[] while l:curline <= a:end - let l:curproj=strpart(matchstr(getline(l:curline),a:symbol.'\a*'),1) + let l:curproj=strpart(matchstr(getline(l:curline),a:symbol.'\S*'),1) if l:curproj != "" && index(l:groups,l:curproj) == -1 let l:groups=add(l:groups , l:curproj) endif