mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
Shell: Use strncmp() instead of string.compare() for name completions
The "at most n bytes" behaviour of strncmp is required for this logic to
work, this was overlooked in 5b64abe
when converting Strings to
StringViews, which lead to broken autocomplete.
This commit is contained in:
parent
14d1601a76
commit
222e580fa8
Notes:
sideshowbarker
2024-07-17 19:46:43 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/222e580fa8b Pull-request: https://github.com/SerenityOS/serenity/pull/12293
1 changed files with 6 additions and 1 deletions
|
@ -1453,7 +1453,12 @@ Vector<Line::CompletionSuggestion> Shell::complete_program_name(StringView name,
|
|||
cached_path.span(),
|
||||
name,
|
||||
nullptr,
|
||||
[](auto& name, auto& program) { return name.compare(program.view()); });
|
||||
[](auto& name, auto& program) {
|
||||
return strncmp(
|
||||
name.characters_without_null_termination(),
|
||||
program.characters(),
|
||||
name.length());
|
||||
});
|
||||
|
||||
if (!match)
|
||||
return complete_path("", name, offset, ExecutableOnly::Yes);
|
||||
|
|
Loading…
Add table
Reference in a new issue