mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
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:
parent
e2886aabcd
commit
2b3e9c28b2
1 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue