aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin_complete.cpp
diff options
context:
space:
mode:
authorGravatar Siteshwar Vashisht <siteshwar@gmail.com>2012-01-16 22:26:47 +0530
committerGravatar Siteshwar Vashisht <siteshwar@gmail.com>2012-01-16 22:26:47 +0530
commit140ead65b6a7051a8737623b7201f5b5a07d55d9 (patch)
treeb93cb8f9936db93ae37030272f6d2c5205097987 /builtin_complete.cpp
parentf3e2d2f68f14120e298fb1d50be89fa5e83c9222 (diff)
Converted all auto completion calls (on pressing tab) to use std::vector<completion_t>, bugs are yet to be fixed
Diffstat (limited to 'builtin_complete.cpp')
-rw-r--r--builtin_complete.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/builtin_complete.cpp b/builtin_complete.cpp
index b268a016..cf655f84 100644
--- a/builtin_complete.cpp
+++ b/builtin_complete.cpp
@@ -541,7 +541,7 @@ static int builtin_complete( wchar_t **argv )
{
if( do_complete )
{
- array_list_t *comp;
+ std::vector<completion_t> comp;
int i;
const wchar_t *prev_temporary_buffer = temporary_buffer;
@@ -556,16 +556,17 @@ static int builtin_complete( wchar_t **argv )
{
recursion_level++;
- comp = al_halloc( 0 );
+// comp = al_halloc( 0 );
- complete( do_complete, comp );
+ complete2( do_complete, comp );
- for( i=0; i<al_get_count( comp ); i++ )
+ for( i=0; i< comp.size() ; i++ )
{
- completion_t *next = (completion_t *)al_get( comp, i );
+ const completion_t &next = comp.at( i );
+
const wchar_t *prepend;
- if( next->flags & COMPLETE_NO_CASE )
+ if( next.flags & COMPLETE_NO_CASE )
{
prepend = L"";
}
@@ -575,17 +576,17 @@ static int builtin_complete( wchar_t **argv )
}
- if( next->description )
+ if( !(next.description).empty() )
{
- sb_printf( sb_out, L"%ls%ls\t%ls\n", prepend, next->completion, next->description );
+ sb_printf( sb_out, L"%ls%ls\t%ls\n", prepend, next.completion.c_str(), next.description.c_str() );
}
else
{
- sb_printf( sb_out, L"%ls%ls\n", prepend, next->completion );
+ sb_printf( sb_out, L"%ls%ls\n", prepend, next.completion.c_str() );
}
}
- halloc_free( comp );
+// halloc_free( comp );
recursion_level--;
}