aboutsummaryrefslogtreecommitdiffhomepage
path: root/complete.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-05-05 14:33:24 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-05-05 14:33:24 -0700
commitac3dce38f017c3cf93b030d433fadb8083d3e884 (patch)
tree0add6743ec5ac2492acf0bf5f4c03e2487b5a80e /complete.cpp
parent3be07cc64506477e2bf195b7c297b8d6d3050173 (diff)
Better fix to make cd completions work again
Diffstat (limited to 'complete.cpp')
-rw-r--r--complete.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/complete.cpp b/complete.cpp
index 57720e6d..06da23d8 100644
--- a/complete.cpp
+++ b/complete.cpp
@@ -1159,18 +1159,19 @@ void completer_t::complete_from_args( const wcstring &str,
const wcstring &desc,
complete_flags_t flags )
{
- /* If type is COMPLETE_AUTOSUGGEST, it means we're on a background thread, so don't call proc_push_interactive */
std::vector<completion_t> possible_comp;
- parser_t parser(PARSER_TYPE_COMPLETIONS_ONLY);
-
- if (this->type != COMPLETE_AUTOSUGGEST)
+ bool is_autosuggest = (this->type == COMPLETE_AUTOSUGGEST);
+ parser_t parser(is_autosuggest ? PARSER_TYPE_COMPLETIONS_ONLY : PARSER_TYPE_GENERAL);
+
+ /* 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);
parser.eval_args( args.c_str(), possible_comp );
- if (this->type != COMPLETE_AUTOSUGGEST)
+ if (is_autosuggest)
proc_pop_interactive();
complete_strings( this->completions, str.c_str(), desc.c_str(), 0, possible_comp, flags );