mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Make it possible to specify the -u switch tom complete without actually specifying any new completions, since it affects all previous completions
darcs-hash:20070128032416-ac50b-93b943d712ac072f1bdb7f568e8064f73ffb85e0.gz
This commit is contained in:
parent
fcbdb6f2a7
commit
fc87b3c4b4
2 changed files with 100 additions and 53 deletions
|
@ -128,9 +128,16 @@ static void builtin_complete_add( array_list_t *cmd,
|
|||
const wchar_t *desc )
|
||||
{
|
||||
int i;
|
||||
int has_content =( wcslen( short_opt ) ||
|
||||
al_get_count( gnu_opt ) ||
|
||||
al_get_count( old_opt ) ||
|
||||
comp );
|
||||
|
||||
for( i=0; i<al_get_count( cmd ); i++ )
|
||||
{
|
||||
if( has_content )
|
||||
{
|
||||
|
||||
builtin_complete_add2( al_get( cmd, i ),
|
||||
COMMAND,
|
||||
short_opt,
|
||||
|
@ -142,9 +149,27 @@ static void builtin_complete_add( array_list_t *cmd,
|
|||
comp,
|
||||
desc );
|
||||
}
|
||||
else
|
||||
{
|
||||
complete_add( al_get( cmd, i ),
|
||||
COMMAND,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
authorative,
|
||||
0,
|
||||
0,
|
||||
0 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for( i=0; i<al_get_count( path ); i++ )
|
||||
{
|
||||
if( has_content )
|
||||
{
|
||||
|
||||
builtin_complete_add2( al_get( path, i ),
|
||||
PATH,
|
||||
short_opt,
|
||||
|
@ -156,7 +181,20 @@ static void builtin_complete_add( array_list_t *cmd,
|
|||
comp,
|
||||
desc );
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
complete_add( al_get( cmd, i ),
|
||||
PATH,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
authorative,
|
||||
0,
|
||||
0,
|
||||
0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
13
complete.c
13
complete.c
|
@ -346,7 +346,9 @@ static int condition_test( const wchar_t *condition )
|
|||
*/
|
||||
static void complete_free_opt_recursive( complete_entry_opt_t *o )
|
||||
{
|
||||
if( o->next != 0 )
|
||||
if( !o )
|
||||
return;
|
||||
|
||||
complete_free_opt_recursive( o->next );
|
||||
halloc_free( o );
|
||||
}
|
||||
|
@ -425,11 +427,15 @@ void complete_add( const wchar_t *cmd,
|
|||
c->short_opt_str = wcsdup(L"");
|
||||
}
|
||||
|
||||
c->authorative = authorative;
|
||||
|
||||
if( short_opt != L'\0' || long_opt )
|
||||
{
|
||||
|
||||
opt = halloc( 0, sizeof( complete_entry_opt_t ) );
|
||||
|
||||
opt->next = c->first_option;
|
||||
c->first_option = opt;
|
||||
c->authorative = authorative;
|
||||
if( short_opt != L'\0' )
|
||||
{
|
||||
int len = 1 + ((result_mode & NO_COMMON) != 0);
|
||||
|
@ -460,6 +466,9 @@ void complete_add( const wchar_t *cmd,
|
|||
{
|
||||
opt->desc = L"";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue