From 71677a15d8a0d6d4b695a013a1d3bb2de5bb7ff1 Mon Sep 17 00:00:00 2001 From: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> Date: Wed, 23 Aug 2023 20:00:46 -0400 Subject: [PATCH] Switch to StartsWith using StringComparison.Ordinal --- .../launcher/PowerLauncher/ViewModel/MainViewModel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs index d9ecdd45da..f8eff3f4d0 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs @@ -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)); }