mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
Change output format of complete -C to make writing case insensitive command specific completions more transparent
darcs-hash:20070420195506-ac50b-b5f56bb2964e65d13abfb9281ce26db2b8c341b7.gz
This commit is contained in:
parent
4d5c50cbb3
commit
06688fb9ea
8 changed files with 32 additions and 12 deletions
|
@ -548,6 +548,11 @@ static int builtin_complete( wchar_t **argv )
|
|||
int i;
|
||||
|
||||
const wchar_t *prev_temporary_buffer = temporary_buffer;
|
||||
|
||||
wchar_t *token;
|
||||
|
||||
parse_util_token_extent( do_complete, wcslen( do_complete ), &token, 0, 0, 0 );
|
||||
|
||||
temporary_buffer = do_complete;
|
||||
|
||||
if( recursion_level < 1 )
|
||||
|
@ -561,13 +566,25 @@ static int builtin_complete( wchar_t **argv )
|
|||
for( i=0; i<al_get_count( comp ); i++ )
|
||||
{
|
||||
completion_t *next = (completion_t *)al_get( comp, i );
|
||||
if( next->description )
|
||||
wchar_t *prepend;
|
||||
|
||||
if( next->flags & COMPLETE_NO_CASE )
|
||||
{
|
||||
sb_printf( sb_out, L"%ls\t%ls\n", next->completion, next->description );
|
||||
prepend = L"";
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_printf( sb_out, L"%ls\n", next->completion );
|
||||
prepend = token;
|
||||
}
|
||||
|
||||
|
||||
if( next->description )
|
||||
{
|
||||
sb_printf( sb_out, L"%ls%ls\t%ls\n", prepend, next->completion, next->description );
|
||||
}
|
||||
else
|
||||
{
|
||||
sb_printf( sb_out, L"%ls%ls\n", prepend, next->completion );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -889,6 +889,7 @@ static void complete_strings( array_list_t *comp_out,
|
|||
for( i=0; i<al_get_count( possible_comp ); i++ )
|
||||
{
|
||||
wchar_t *next_str = (wchar_t *)al_get( possible_comp, i );
|
||||
|
||||
if( next_str )
|
||||
{
|
||||
wildcard_complete( next_str, wc, desc, desc_func, comp_out, flags );
|
||||
|
|
|
@ -73,7 +73,11 @@
|
|||
#define COMPLETE_NO_SPACE 1
|
||||
|
||||
/**
|
||||
This compeltion is case insensitive
|
||||
This compeltion is case insensitive.
|
||||
|
||||
Warning: The contents of the completion_t structure is actually
|
||||
different if this flag is set! Specifically, the completion string
|
||||
contains the _entire_ completion token, not only the current
|
||||
*/
|
||||
#define COMPLETE_NO_CASE 2
|
||||
|
||||
|
|
|
@ -9,4 +9,4 @@ complete -c type -s P -l force-path --description "Print path to command"
|
|||
complete -c type -a "(builtin -n)" --description "Builtin"
|
||||
complete -c type -a "(functions -n)" --description "Function"
|
||||
|
||||
complete -c type -a "(commandline -ct)(complete -C(commandline -ct))" -x
|
||||
complete -c type -a "(complete -C(commandline -ct))" -x
|
||||
|
|
|
@ -12,4 +12,4 @@ complete -c which -l tty-only --description "Stop processing options on the righ
|
|||
complete -c which -s v -s V -l version --description "Display version and exit"
|
||||
complete -c which -l help --description "Display help and exit"
|
||||
|
||||
complete -c which -a "(commandline -ct)(complete -C(commandline -ct))" -x
|
||||
complete -c which -a "(complete -C(commandline -ct))" -x
|
||||
|
|
|
@ -101,7 +101,7 @@ complete -c xterm -o wc --description 'Use wide characters'
|
|||
complete -c xterm -o wf --description 'Wait the first time for the window to be mapped'
|
||||
complete -c xterm -o Sccn --description 'Use as input/output channel for an existing program'
|
||||
|
||||
complete -c xterm -s e -a "(commandline -ct)(complete -C(commandline -ct))" -x --description 'Run program in xterm'
|
||||
complete -c xterm -s e -a "(complete -C(commandline -ct))" -x --description 'Run program in xterm'
|
||||
|
||||
complete -r -c xterm -o bcf --description 'Blinking cursor will be off for that many milliseconds'
|
||||
complete -r -c xterm -o bcn --description 'Blinking cursor will be on for that many milliseconds'
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
|
||||
|
||||
function __fish_complete_file_url
|
||||
set -l comp
|
||||
|
||||
|
@ -14,9 +12,9 @@ function __fish_complete_file_url
|
|||
|
||||
if test file:// = $prefix
|
||||
set -l stripped (echo $comp|cut -c 8-)
|
||||
printf "%s\n" $comp(complete -C"echo $stripped")
|
||||
printf "%s\n" file://(complete -C"echo $stripped")
|
||||
else
|
||||
echo file://
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@ function __fish_complete_subcommand -d "Complete subcommand"
|
|||
end
|
||||
end
|
||||
|
||||
printf "%s\n" (commandline -ct)(complete -C$res)
|
||||
printf "%s\n" (complete -C$res)
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue