mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-16 15:04:05 +00:00
complete: use remove_if+erase instead of raw loop to remove leading decorators
In theory this does less work so we should generally use this style. In practice it looks uglier so I'm not sure. Maybe wait for stdlib ranges... No functional change.
This commit is contained in:
parent
613ecfc7e4
commit
b3a8e85b0f
1 changed files with 6 additions and 2 deletions
|
@ -1511,8 +1511,12 @@ void completer_t::perform_for_commandline(wcstring cmdline) {
|
|||
|
||||
// Hack: fix autosuggestion by removing prefixing "and"s #6249.
|
||||
if (is_autosuggest) {
|
||||
while (!tokens.empty() && parser_keywords_is_subcommand(tokens.front().get_source(cmdline)))
|
||||
tokens.erase(tokens.begin());
|
||||
tokens.erase(
|
||||
std::remove_if(tokens.begin(), tokens.end(),
|
||||
[&cmdline](const tok_t &token) {
|
||||
return parser_keywords_is_subcommand(token.get_source(cmdline));
|
||||
}),
|
||||
tokens.end());
|
||||
}
|
||||
|
||||
// Consume variable assignments in tokens strictly before the cursor.
|
||||
|
|
Loading…
Reference in a new issue