Fix to prevent autoloading of completions on highlight thread

This commit is contained in:
ridiculousfish 2012-01-15 14:24:58 -08:00
parent 1b3427acd9
commit 55091d9deb
3 changed files with 7 additions and 6 deletions

View file

@ -610,7 +610,8 @@ static void parse_cmd_string( void *context,
int complete_is_valid_option( const wchar_t *str, int complete_is_valid_option( const wchar_t *str,
const wchar_t *opt, const wchar_t *opt,
array_list_t *errors ) array_list_t *errors,
bool allow_autoload )
{ {
complete_entry_t *i; complete_entry_t *i;
complete_entry_opt_t *o; 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 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 ) 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 ); hash_destroy( &gnu_match_hash );
halloc_free( context ); 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, int complete_is_valid_argument( const wchar_t *str,

View file

@ -223,7 +223,8 @@ void complete_print( string_buffer_t *out );
*/ */
int complete_is_valid_option( const wchar_t *str, int complete_is_valid_option( const wchar_t *str,
const wchar_t *opt, 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 Tests if the specified argument is valid for the specified option

View file

@ -588,7 +588,7 @@ void tokenize( const wchar_t * const buff, int * const color, const int pos, arr
} }
else if( accept_switches ) 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; color[ tok_get_pos( &tok ) ] = HIGHLIGHT_PARAM;
else else
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR; color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR;