Fixed more known auto completion bugs; auto completion calls working fine now

This commit is contained in:
Siteshwar Vashisht 2012-01-20 22:20:31 +05:30
parent 0c99fc5b4d
commit 062e423125
3 changed files with 28 additions and 29 deletions

View file

@ -1033,7 +1033,8 @@ static void complete_cmd_desc( const wchar_t *cmd, std::vector<completion_t> &co
for( i=0; i<comp.size(); i++ )
{
completion_t &c = comp.at( i );
const wchar_t *el = c.completion.empty()?NULL:c.completion.c_str();
// const wchar_t *el = c.completion.empty()?NULL:c.completion.c_str();
const wchar_t *el = c.completion.c_str();
wchar_t *new_desc;

View file

@ -1208,8 +1208,10 @@ static void run_pager( wchar_t *prefix, int is_quoted, const std::vector<complet
continue;
}
if( !el.completion.empty() )
{
if( el.completion.empty() ){
continue;
}
if( el.flags & COMPLETE_NO_CASE )
{
if( base_len == -1 )
@ -1220,14 +1222,15 @@ static void run_pager( wchar_t *prefix, int is_quoted, const std::vector<complet
base_len = data->buff_pos - (begin-data->buff);
}
foo = escape( el.completion.c_str() + base_len, ESCAPE_ALL | ESCAPE_NO_QUOTED );
wcstring foo_wstr = escape_string( el.completion.c_str() + base_len, ESCAPE_ALL | ESCAPE_NO_QUOTED );
foo = wcsdup(foo_wstr.c_str());
}
else
{
wcstring foo_wstr = escape_string( el.completion, ESCAPE_ALL | ESCAPE_NO_QUOTED );
foo = wcsdup(foo_wstr.c_str());
}
}
if( !el.description.empty() )
{

View file

@ -251,11 +251,6 @@ static int wildcard_complete_internal( const wchar_t *orig,
wchar_t *out_completion = 0;
const wchar_t *out_desc = desc;
if( out.empty() )
{
return 1;
}
if( flags & COMPLETE_NO_CASE )
{
out_completion = wcsdup( orig );
@ -319,7 +314,7 @@ static int wildcard_complete_internal( const wchar_t *orig,
do
{
res |= wildcard_complete_internal( orig, str, wc+1, 0, desc, desc_func, out, flags );
if( res && out.empty() )
if( res )
break;
}
while( *str++ != 0 );
@ -1190,7 +1185,7 @@ int wildcard_expand( const wchar_t *wc,
if( c.flags & COMPLETE_NO_CASE )
{
sb_clear( &sb );
sb_printf( &sb, L"%ls%ls%ls", base_dir, wc_base, c.completion );
sb_printf( &sb, L"%ls%ls%ls", base_dir, wc_base, c.completion.c_str() );
c.completion = (wchar_t *)sb.buff;
}