From 64b3a62dd989838c2008938c7cec8fd3f0e7f953 Mon Sep 17 00:00:00 2001 From: Garulf <535299+Garulf@users.noreply.github.com> Date: Sat, 4 Dec 2021 13:31:54 -0500 Subject: [PATCH] When QueryTextBox scrolls hide Suggestion --- .../Converters/QuerySuggestionBoxConverter.cs | 12 +++++------- Flow.Launcher/MainWindow.xaml | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs index 64e75f573..bfff27829 100644 --- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs +++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs @@ -11,14 +11,12 @@ namespace Flow.Launcher.Converters { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { - if (values.Length != 3) + if (values.Length != 2) { return string.Empty; } - var QueryText = values[1] as TextBox; - var Suggestion = values[0] as TextBox; - Suggestion.CaretIndex = QueryText.CaretIndex; - Suggestion.ScrollToHorizontalOffset(QueryText.HorizontalOffset); + var QueryText = values[0] as TextBox; + // first prop is the current query string var queryText = QueryText.Text; @@ -27,7 +25,7 @@ namespace Flow.Launcher.Converters return string.Empty; // second prop is the current selected item result - var val = values[2]; + var val = values[1]; if (val == null) { return string.Empty; @@ -45,7 +43,7 @@ namespace Flow.Launcher.Converters var selectedResultActionKeyword = string.IsNullOrEmpty(selectedResult.ActionKeywordAssigned) ? "" : selectedResult.ActionKeywordAssigned + " "; var selectedResultPossibleSuggestion = selectedResultActionKeyword + selectedResult.Title; - if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase)) + if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase) || QueryText.HorizontalOffset != 0) return string.Empty; // When user typed lower case and result title is uppercase, we still want to display suggestion diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 66278905f..9c74e417b 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -161,7 +161,6 @@ Style="{DynamicResource QuerySuggestionBoxStyle}"> -