Shell: Take whitespace into account when suggesting tokens

Prior to this, we did not care if there was any whitespace after the
last token in the prompt, and this caused a regression:
```
> lsp <tab>
> lsp ci
```
This commit is contained in:
AnotherTest 2020-05-21 18:04:33 +04:30 committed by Andreas Kling
parent e2886aabcd
commit 2b3e9c28b2

View file

@ -1501,8 +1501,14 @@ Vector<Line::CompletionSuggestion> Shell::complete(const Line::Editor& editor)
if (args.last().type == Token::Comment) // we cannot complete comments
return {};
is_first_in_subcommand = args.size() == 1;
token = last_command.args.last().text;
if (args.last().end != line.length()) {
// There was a token separator at the end
is_first_in_subcommand = false;
token = "";
} else {
is_first_in_subcommand = args.size() == 1;
token = last_command.args.last().text;
}
}
}