mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +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
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(),
|
cached_path.span(),
|
||||||
name,
|
name,
|
||||||
nullptr,
|
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)
|
if (!match)
|
||||||
return complete_path("", name, offset, ExecutableOnly::Yes);
|
return complete_path("", name, offset, ExecutableOnly::Yes);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue