Skip command description lookup when no commands where found

darcs-hash:20061018155151-ac50b-5562479da23b89571f91ae1e2ed15e640ef0a094.gz
This commit is contained in:
axel
2006-10-19 01:51:51 +10:00
parent b32bbb24b9
commit 2ab04f4043

View File

@@ -1271,9 +1271,11 @@ static void complete_cmd( const wchar_t *cmd,
wchar_t *cdpath = env_get(L"CDPATH"); wchar_t *cdpath = env_get(L"CDPATH");
wchar_t *cdpath_cpy = wcsdup( cdpath?cdpath:L"." ); wchar_t *cdpath_cpy = wcsdup( cdpath?cdpath:L"." );
int prev_count = al_get_count( comp );
if( (wcschr( cmd, L'/') != 0) || (cmd[0] == L'~' ) ) if( (wcschr( cmd, L'/') != 0) || (cmd[0] == L'~' ) )
{ {
array_list_t tmp; array_list_t tmp;
al_init( &tmp ); al_init( &tmp );
@@ -1282,7 +1284,10 @@ static void complete_cmd( const wchar_t *cmd,
comp, comp,
ACCEPT_INCOMPLETE | EXECUTABLES_ONLY ) != EXPAND_ERROR ) ACCEPT_INCOMPLETE | EXECUTABLES_ONLY ) != EXPAND_ERROR )
{ {
complete_cmd_desc( cmd, comp ); if( al_get_count( comp ) > prev_count )
{
complete_cmd_desc( cmd, comp );
}
} }
al_destroy( &tmp ); al_destroy( &tmp );
} }
@@ -1324,7 +1329,10 @@ static void complete_cmd( const wchar_t *cmd,
} }
free( path_cpy ); free( path_cpy );
complete_cmd_desc( cmd, comp ); if( al_get_count( comp ) > prev_count )
{
complete_cmd_desc( cmd, comp );
}
} }
/* /*
@@ -1575,6 +1583,7 @@ static void complete_load_handler( const wchar_t *cmd )
void complete_load( const wchar_t *name, int reload ) void complete_load( const wchar_t *name, int reload )
{ {
CHECK( name, );
parse_util_load( name, parse_util_load( name,
L"fish_complete_path", L"fish_complete_path",
&complete_load_handler, &complete_load_handler,
@@ -2186,6 +2195,8 @@ void complete_print( string_buffer_t *out )
{ {
complete_entry *e; complete_entry *e;
CHECK( out, );
for( e = first_entry; e; e=e->next ) for( e = first_entry; e; e=e->next )
{ {
complete_entry_opt *o; complete_entry_opt *o;