diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-15 14:24:58 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-15 14:24:58 -0800 |
commit | 55091d9deb19a1018a1740f0fff3ae1751248f65 (patch) | |
tree | 9b285332acc8980815fb53d2837ee3bbc5aba57c | |
parent | 1b3427acd9fb01ff2816304c1dc6db6c945e9661 (diff) |
Fix to prevent autoloading of completions on highlight thread
-rw-r--r-- | complete.cpp | 8 | ||||
-rw-r--r-- | complete.h | 3 | ||||
-rw-r--r-- | highlight.cpp | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/complete.cpp b/complete.cpp index 3bb31419..d10886b6 100644 --- a/complete.cpp +++ b/complete.cpp @@ -610,7 +610,8 @@ static void parse_cmd_string( void *context, int complete_is_valid_option( const wchar_t *str, const wchar_t *opt, - array_list_t *errors ) + array_list_t *errors, + bool allow_autoload ) { complete_entry_t *i; complete_entry_opt_t *o; @@ -696,7 +697,7 @@ int complete_is_valid_option( const wchar_t *str, /* Make sure completions are loaded for the specified command */ - complete_load( cmd, 0 ); + if (allow_autoload) complete_load( cmd, 0 ); for( i=first_entry; i; i=i->next ) { @@ -845,8 +846,7 @@ int complete_is_valid_option( const wchar_t *str, hash_destroy( &gnu_match_hash ); halloc_free( context ); - - return (authoritative && found_match)?opt_found:1; + return (authoritative && found_match)?opt_found:1; } int complete_is_valid_argument( const wchar_t *str, @@ -223,7 +223,8 @@ void complete_print( string_buffer_t *out ); */ int complete_is_valid_option( const wchar_t *str, const wchar_t *opt, - array_list_t *errors ); + array_list_t *errors, + bool allow_autoload ); /** Tests if the specified argument is valid for the specified option diff --git a/highlight.cpp b/highlight.cpp index c9f0d7ef..a618078d 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -588,7 +588,7 @@ void tokenize( const wchar_t * const buff, int * const color, const int pos, arr } else if( accept_switches ) { - if( complete_is_valid_option( last_cmd, param, error ) ) + if( complete_is_valid_option( last_cmd, param, error, false /* no autoload */ ) ) color[ tok_get_pos( &tok ) ] = HIGHLIGHT_PARAM; else color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR; |