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
Notes: sideshowbarker 2024-07-19 05:08:15 +09:00

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)
{
size_t start = 0;
while (start < option.length() && option[start] == '-')
while (start < option.length() && option[start] == '-' && start < 2)
++start;
auto option_pattern = offset > start ? option.substring_view(start, offset - start) : "";
editor->suggest(offset);