From 87223c68f4df8aa4de7256be398569bc957fed2f Mon Sep 17 00:00:00 2001 From: axel Date: Tue, 17 Apr 2007 07:06:05 +1000 Subject: [PATCH] =?UTF-8?q?Fix=20bug=20where=20case=20insensitive=20comple?= =?UTF-8?q?tions=20would=20miss=20the=20leading=20slash=20in=20file=20comp?= =?UTF-8?q?letions.=20This=20bug=20was=20reported=20by=20Claes=20N=C3=A4st?= =?UTF-8?q?=C3=A9n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit darcs-hash:20070416210605-ac50b-eb1bc315ec360f8ccd5f37194c274796be97c607.gz --- wildcard.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/wildcard.c b/wildcard.c index 150fce39a..41f8f1b62 100644 --- a/wildcard.c +++ b/wildcard.c @@ -1189,35 +1189,36 @@ int wildcard_expand( const wchar_t *wc, if( flags & ACCEPT_INCOMPLETE ) { - wchar_t *wc_base; + wchar_t *wc_base=L""; wchar_t *wc_base_ptr = wcsrchr( wc, L'/' ); + string_buffer_t sb; + if( wc_base_ptr ) { - string_buffer_t sb; - - sb_init( &sb ); wc_base = wcsndup( wc, (wc_base_ptr-wc)+1 ); - - for( i=c; iflags & COMPLETE_NO_CASE ) - { - sb_clear( &sb ); - sb_printf( &sb, L"%ls%ls", wc_base, c->completion ); - - c->completion = halloc_wcsdup( out, (wchar_t *)sb.buff ); - } - } - - sb_destroy( &sb ); - free( wc_base ); - } + sb_init( &sb ); + + for( i=c; iflags & COMPLETE_NO_CASE ) + { + sb_clear( &sb ); + sb_printf( &sb, L"%ls%ls%ls", base_dir, wc_base, c->completion ); + + c->completion = halloc_wcsdup( out, (wchar_t *)sb.buff ); + } + } + + sb_destroy( &sb ); + + if( wc_base_ptr ) + free( wc_base ); + } - return res; }