Fix for process expansion off the main thread in syntax highlighting

(#1143)
This commit is contained in:
ridiculousfish 2013-11-26 23:56:47 -08:00
parent 9f5547327e
commit 84483b4aac

View file

@ -710,7 +710,7 @@ static bool autosuggest_parse_command(const wcstring &str, wcstring *out_command
{ {
/* Command. First check that the command actually exists. */ /* Command. First check that the command actually exists. */
wcstring local_cmd = tok_last(&tok); wcstring local_cmd = tok_last(&tok);
bool expanded = expand_one(cmd, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES); bool expanded = expand_one(cmd, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES | EXPAND_SKIP_JOBS);
if (! expanded || has_expand_reserved(cmd.c_str())) if (! expanded || has_expand_reserved(cmd.c_str()))
{ {
/* We can't expand this cmd, ignore it */ /* We can't expand this cmd, ignore it */
@ -873,7 +873,7 @@ bool autosuggest_validate_from_history(const history_item_t &item, file_detectio
{ {
/* We can possibly handle this specially */ /* We can possibly handle this specially */
wcstring dir = parsed_arguments.back(); wcstring dir = parsed_arguments.back();
if (expand_one(dir, EXPAND_SKIP_CMDSUBST)) if (expand_one(dir, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_JOBS))
{ {
handled = true; handled = true;
bool is_help = string_prefixes_string(dir, L"--help") || string_prefixes_string(dir, L"-h"); bool is_help = string_prefixes_string(dir, L"--help") || string_prefixes_string(dir, L"-h");
@ -997,7 +997,7 @@ static void tokenize(const wchar_t * const buff, std::vector<int> &color, const
if (cmd == L"cd") if (cmd == L"cd")
{ {
wcstring dir = tok_last(&tok); wcstring dir = tok_last(&tok);
if (expand_one(dir, EXPAND_SKIP_CMDSUBST)) if (expand_one(dir, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_JOBS))
{ {
int is_help = string_prefixes_string(dir, L"--help") || string_prefixes_string(dir, L"-h"); int is_help = string_prefixes_string(dir, L"--help") || string_prefixes_string(dir, L"-h");
if (!is_help && ! is_potential_cd_path(dir, working_directory, PATH_EXPAND_TILDE, NULL)) if (!is_help && ! is_potential_cd_path(dir, working_directory, PATH_EXPAND_TILDE, NULL))
@ -1182,7 +1182,7 @@ static void tokenize(const wchar_t * const buff, std::vector<int> &color, const
case TOK_STRING: case TOK_STRING:
{ {
target_str = tok_last(&tok); target_str = tok_last(&tok);
if (expand_one(target_str, EXPAND_SKIP_CMDSUBST)) if (expand_one(target_str, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_JOBS))
{ {
target = target_str.c_str(); target = target_str.c_str();
} }