From 29e86254d01141a8118dd7782a444605cdde13d2 Mon Sep 17 00:00:00 2001 From: axel Date: Mon, 22 May 2006 08:32:13 +1000 Subject: [PATCH] Allow tab completion of empty command names darcs-hash:20060521223213-ac50b-5201b7f0dfe5227f93aae6db94450e165c9a5a34.gz --- complete.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/complete.c b/complete.c index ea55e64dc..00ed2818d 100644 --- a/complete.c +++ b/complete.c @@ -2023,9 +2023,28 @@ void complete( const wchar_t *cmd, current_token = wcsndup( begin, cursor_pos-(begin-cmd) ); prev_token = prev_begin ? wcsndup( prev_begin, prev_end - prev_begin ): wcsdup(L""); - + // fwprintf( stderr, L"on_command: %d, %ls %ls\n", on_command, current_compmand, current_token ); - + if( !had_cmd ) + { + on_command=1; + } + + if( !current_token ) + { + current_token = wcsdup(L""); + } + + if( !current_command ) + { + current_command = wcsdup(L""); + } + + if( !prev_token ) + { + prev_token = wcsdup(L""); + } + if( current_token && current_command && prev_token ) { if( on_command ) @@ -2045,7 +2064,7 @@ void complete( const wchar_t *cmd, */ int do_file; - + do_file = complete_param( current_command, prev_token, current_token, comp ); complete_param_expand( current_token, comp, do_file ); }