diff options
author | axel <axel@liljencrantz.se> | 2007-04-21 05:55:06 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2007-04-21 05:55:06 +1000 |
commit | 06688fb9eaa1b61cbfb92b6f5edf997ffe6dbcff (patch) | |
tree | 673716625965dd45716f2cd676fe7723e6086963 /builtin_complete.c | |
parent | 4d5c50cbb32506db8c4aa53ba804faf32e5015a5 (diff) |
Change output format of complete -C to make writing case insensitive command specific completions more transparent
darcs-hash:20070420195506-ac50b-b5f56bb2964e65d13abfb9281ce26db2b8c341b7.gz
Diffstat (limited to 'builtin_complete.c')
-rw-r--r-- | builtin_complete.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/builtin_complete.c b/builtin_complete.c index 58452b74..19453366 100644 --- a/builtin_complete.c +++ b/builtin_complete.c @@ -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 ); + wchar_t *prepend; + + if( next->flags & COMPLETE_NO_CASE ) + { + prepend = L""; + } + else + { + prepend = token; + } + + if( next->description ) { - sb_printf( sb_out, L"%ls\t%ls\n", next->completion, next->description ); + sb_printf( sb_out, L"%ls%ls\t%ls\n", prepend, next->completion, next->description ); } else { - sb_printf( sb_out, L"%ls\n", next->completion ); + sb_printf( sb_out, L"%ls%ls\n", prepend, next->completion ); } } |