From c3b7e5576258d956a8b059b0ee86f147d67e6fb5 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Sat, 20 Apr 2013 13:27:55 -0700 Subject: [PATCH] FilterAndSortCandidates returns all on empty query Previously it returned an empty list. It makes mores sense to return the input list of candidates because conceptually everything matches an empty query. --- cpp/ycm/PythonSupport.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cpp/ycm/PythonSupport.cpp b/cpp/ycm/PythonSupport.cpp index 71048b9f..432768c7 100644 --- a/cpp/ycm/PythonSupport.cpp +++ b/cpp/ycm/PythonSupport.cpp @@ -64,8 +64,18 @@ boost::python::list FilterAndSortCandidates( const std::string &query ) { pylist filtered_candidates; - if ( query.empty() ) + if ( query.empty() ) { + if ( candidate_property.empty() ) + return candidates; + + int num_candidates = len( candidates ); + + for ( int i = 0; i < num_candidates; ++i ) { + filtered_candidates.append( candidates[ i ][ candidate_property ] ); + } + return filtered_candidates; + } std::vector< const Candidate * > repository_candidates = CandidatesFromObjectList( candidates, candidate_property );