mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-19 22:37:58 +08:00
Switch to StartsWith using StringComparison.Ordinal
This commit is contained in:
parent
5d1c3e6d2d
commit
71677a15d8
@ -1075,7 +1075,7 @@ namespace PowerLauncher.ViewModel
|
||||
else
|
||||
{
|
||||
// Using Ordinal this is internal
|
||||
return string.IsNullOrEmpty(queryText) || autoCompleteText.IndexOf(queryText, StringComparison.Ordinal) != 0;
|
||||
return string.IsNullOrEmpty(queryText) || !autoCompleteText.StartsWith(queryText, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1086,7 +1086,7 @@ namespace PowerLauncher.ViewModel
|
||||
if (index == 0)
|
||||
{
|
||||
// Using OrdinalIgnoreCase because we want the characters to be exact in autocomplete text and the query
|
||||
if (input.IndexOf(query, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
if (input.StartsWith(query, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Use the same case as the input query for the matched portion of the string
|
||||
return string.Concat(query, input.AsSpan(query.Length));
|
||||
@ -1104,7 +1104,7 @@ namespace PowerLauncher.ViewModel
|
||||
if (index == 0 && !string.IsNullOrEmpty(query))
|
||||
{
|
||||
// Using OrdinalIgnoreCase since this is internal
|
||||
if (input.IndexOf(query, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
if (input.StartsWith(query, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return string.Concat(query, input.AsSpan(query.Length));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user