diff options
author | Siteshwar Vashisht <siteshwar@gmail.com> | 2012-01-16 22:26:47 +0530 |
---|---|---|
committer | Siteshwar Vashisht <siteshwar@gmail.com> | 2012-01-16 22:26:47 +0530 |
commit | 140ead65b6a7051a8737623b7201f5b5a07d55d9 (patch) | |
tree | b93cb8f9936db93ae37030272f6d2c5205097987 /common.cpp | |
parent | f3e2d2f68f14120e298fb1d50be89fa5e83c9222 (diff) |
Converted all auto completion calls (on pressing tab) to use std::vector<completion_t>, bugs are yet to be fixed
Diffstat (limited to 'common.cpp')
-rw-r--r-- | common.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -83,6 +83,7 @@ parts of fish. #include "proc.h" #include "wildcard.h" #include "parser.h" +#include "complete.h" #include "util.cpp" #include "halloc.cpp" @@ -155,6 +156,23 @@ wchar_t **list_to_char_arr( array_list_t *l ) return res; } +wchar_t **completions_to_char_arr( std::vector<completion_t> &l ) +{ + wchar_t ** res = (wchar_t **)malloc( sizeof(wchar_t *)*( l.size() + 1) ); + int i; + if( res == 0 ) + { + DIE_MEM(); + } + for( i=0; i< l.size(); i++ ) + { + res[i] = (wchar_t *)l.at(i).completion.c_str(); + } + res[i]='\0'; + return res; +} + + int fgetws2( wchar_t **b, int *len, FILE *f ) { int i=0; @@ -242,6 +260,10 @@ void sort_strings( std::vector<wcstring> &strings) std::sort(strings.begin(), strings.end(), string_sort_predicate); } +void sort_completions( std::vector<completion_t> &completions) +{ + std::sort(completions.begin(), completions.end()); +} wchar_t *str2wcs( const char *in ) { wchar_t *out; |