Eliminate shell_is_interactive

We used to have a global notion of "is the shell interactive" but soon we
will want to have multiple independent execution threads, only some of
which may be interactive. Start tracking this data per-parser.
This commit is contained in:
ridiculousfish
2019-05-27 14:52:48 -07:00
parent 3f1d7bbdc5
commit 4a2c709fb1
20 changed files with 85 additions and 104 deletions

View File

@@ -748,10 +748,10 @@ void completer_t::complete_from_args(const wcstring &str, const wcstring &args,
const wcstring &desc, complete_flags_t flags) {
bool is_autosuggest = (this->type() == COMPLETE_AUTOSUGGEST);
// If type is COMPLETE_AUTOSUGGEST, it means we're on a background thread, so don't call
// proc_push_interactive.
if (!is_autosuggest) {
proc_push_interactive(0);
bool saved_interactive = false;
if (parser) {
saved_interactive = parser->libdata().is_interactive;
parser->libdata().is_interactive = false;
}
expand_flags_t eflags{};
@@ -763,8 +763,8 @@ void completer_t::complete_from_args(const wcstring &str, const wcstring &args,
std::vector<completion_t> possible_comp =
parser_t::expand_argument_list(args, eflags, vars, parser);
if (!is_autosuggest) {
proc_pop_interactive();
if (parser) {
parser->libdata().is_interactive = saved_interactive;
}
this->complete_strings(escape_string(str, ESCAPE_ALL), const_desc(desc), possible_comp, flags);