mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09: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
Notes:
sideshowbarker
2024-07-19 06:14:17 +09:00
Author: https://github.com/alimpfard
Commit: 2b3e9c28b2
Pull-request: https://github.com/SerenityOS/serenity/pull/2320
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bugaevc
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
Add a link
Reference in a new issue