From 43ab84397bfaca93aa439f4b35ae2774c3bb164e Mon Sep 17 00:00:00 2001 From: axel Date: Sun, 19 Feb 2006 11:14:32 +1000 Subject: [PATCH] Make sure that command specific completions can handle input strings with wildcards reasonably well darcs-hash:20060219011432-ac50b-89a73a3d414f2dbd8a213b851fcb1c494e022eae.gz --- builtin.c | 4 +++- common.c | 2 -- complete.c | 14 +++++++++----- main.c | 2 +- parse_util.c | 38 ++++++++++++++++++++++++++++++++++++++ parse_util.h | 5 +++++ wildcard.c | 1 - 7 files changed, 56 insertions(+), 10 deletions(-) diff --git a/builtin.c b/builtin.c index 7cfc6559f..dee20bff6 100644 --- a/builtin.c +++ b/builtin.c @@ -2968,8 +2968,10 @@ static int builtin_case( wchar_t **argv ) for( i=1; iparam1.switch_value, unescaped ) ) { current_block->skip = 0; diff --git a/common.c b/common.c index 228e061f7..32f853c2f 100644 --- a/common.c +++ b/common.c @@ -527,8 +527,6 @@ int wcsvarname( wchar_t *str ) str++; } return 1; - - } diff --git a/complete.c b/complete.c index f5e3fe333..90e4173e7 100644 --- a/complete.c +++ b/complete.c @@ -1001,17 +1001,21 @@ static void copy_strings_with_prefix( array_list_t *comp_out, array_list_t *possible_comp ) { int i; - wchar_t *wc; + wchar_t *wc, *tmp; - wc = expand_one( 0, + tmp = expand_one( 0, wcsdup(wc_escaped), EXPAND_SKIP_SUBSHELL | EXPAND_SKIP_WILDCARDS); - if(!wc) + if(!tmp) return; - if( wc[0] == L'~' ) + if( tmp[0] == L'~' ) { - wc=expand_tilde(wc); + tmp=expand_tilde(wc); } + + wc = parse_util_unescape_wildcards( tmp ); + free(tmp); + // int str_len = wcslen( str ); for( i=0; i