mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
Don't autosuggest files until after we've tried (and maybe failed) to load completions
Fixes https://github.com/fish-shell/fish-shell/issues/378
This commit is contained in:
parent
93e2415924
commit
918f84438f
1 changed files with 13 additions and 4 deletions
17
complete.cpp
17
complete.cpp
|
@ -401,6 +401,11 @@ public:
|
||||||
lst->insert(lst->end(), commands_to_load.begin(), commands_to_load.end());
|
lst->insert(lst->end(), commands_to_load.begin(), commands_to_load.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool has_commands_to_load() const
|
||||||
|
{
|
||||||
|
return ! commands_to_load.empty();
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Autoloader for completions */
|
/* Autoloader for completions */
|
||||||
|
@ -1944,7 +1949,7 @@ void complete(const wcstring &cmd, std::vector<completion_t> &comps, complete_ty
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int do_file=0;
|
bool do_file = false;
|
||||||
|
|
||||||
wcstring current_command_unescape = current_command;
|
wcstring current_command_unescape = current_command;
|
||||||
wcstring prev_token_unescape = prev_token;
|
wcstring prev_token_unescape = prev_token;
|
||||||
|
@ -1960,12 +1965,16 @@ void complete(const wcstring &cmd, std::vector<completion_t> &comps, complete_ty
|
||||||
!had_ddash);
|
!had_ddash);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* If we have found no command specific completions at
|
||||||
If we have found no command specific completions at
|
|
||||||
all, fall back to using file completions.
|
all, fall back to using file completions.
|
||||||
*/
|
*/
|
||||||
if (completer.empty())
|
if (completer.empty())
|
||||||
do_file = 1;
|
do_file = true;
|
||||||
|
|
||||||
|
/* But if we are planning on loading commands, don't do file completions.
|
||||||
|
See https://github.com/fish-shell/fish-shell/issues/378 */
|
||||||
|
if (commands_to_load != NULL && completer.has_commands_to_load())
|
||||||
|
do_file = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This function wants the unescaped string
|
This function wants the unescaped string
|
||||||
|
|
Loading…
Reference in a new issue