1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 14:15:07 +00:00

Shell: Do not remove more than 2 dashes from the option being completed

This makes '------inl' a completion request for an option named
'----inl' instead of 'inl'.
This commit is contained in:
AnotherTest 2020-07-05 18:38:38 +04:30 committed by Andreas Kling
parent 9cc32d6e95
commit ddbdd0e686

View file

@ -831,7 +831,7 @@ Vector<Line::CompletionSuggestion> Shell::complete_user(const String& name, size
Vector<Line::CompletionSuggestion> Shell::complete_option(const String& program_name, const String& option, size_t offset) Vector<Line::CompletionSuggestion> Shell::complete_option(const String& program_name, const String& option, size_t offset)
{ {
size_t start = 0; size_t start = 0;
while (start < option.length() && option[start] == '-') while (start < option.length() && option[start] == '-' && start < 2)
++start; ++start;
auto option_pattern = offset > start ? option.substring_view(start, offset - start) : ""; auto option_pattern = offset > start ? option.substring_view(start, offset - start) : "";
editor->suggest(offset); editor->suggest(offset);