From e58110da2cf144475be44577a20dae02276e367a Mon Sep 17 00:00:00 2001 From: axel Date: Wed, 15 Feb 2006 12:46:44 +1000 Subject: [PATCH] Reset list of loaded completion files when running complete_destroy. Otherwise completions will not get propely loaded on language changes. darcs-hash:20060215024644-ac50b-d259cdac14dccb55309a4702683f1b881636e9ac.gz --- complete.c | 10 +++++++++- parse_util.c | 19 ++++++++++++++++--- parse_util.h | 2 ++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/complete.c b/complete.c index a0dcd9236..f7e9a1f6d 100644 --- a/complete.c +++ b/complete.c @@ -325,7 +325,8 @@ void complete_init() void complete_destroy() { complete_entry *i=first_entry, *prev; - + wchar_t *path; + while( i ) { prev = i; @@ -341,6 +342,13 @@ void complete_destroy() free( suffix_hash ); suffix_hash=0; } + + path = env_get( L"fish_complete_path" ); + + if( path ) + parse_util_load_reset( path ); + + } /** diff --git a/parse_util.c b/parse_util.c index ce5820b80..754e49f51 100644 --- a/parse_util.c +++ b/parse_util.c @@ -460,10 +460,23 @@ static void parse_util_destroy() } } +void parse_util_load_reset( const wchar_t *path_var ) +{ + if( all_loaded ) + { + void *key, *data; + hash_remove( all_loaded, path_var, (const void **)&key, (const void **)&data ); + if( key ) + clear_loaded_entry( key, data ); + } + +} + + int parse_util_load( const wchar_t *cmd, - const wchar_t *path_var, - void (*on_load)(const wchar_t *cmd), - int reload ) + const wchar_t *path_var, + void (*on_load)(const wchar_t *cmd), + int reload ) { static array_list_t *path_list=0; static string_buffer_t *path=0; diff --git a/parse_util.h b/parse_util.h index 81e4dcce8..7562a7417 100644 --- a/parse_util.h +++ b/parse_util.h @@ -79,6 +79,8 @@ int parse_util_load( const wchar_t *cmd, void (*on_load)(const wchar_t *cmd), int reload ); +void parse_util_load_reset( const wchar_t *path_var ); + /** Set the argv environment variable to the specified null-terminated array of strings