Skip to content

Commit 64b3a62

Browse files
committed
When QueryTextBox scrolls hide Suggestion
1 parent 984f2a1 commit 64b3a62

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ public class QuerySuggestionBoxConverter : IMultiValueConverter
1111
{
1212
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
1313
{
14-
if (values.Length != 3)
14+
if (values.Length != 2)
1515
{
1616
return string.Empty;
1717
}
18-
var QueryText = values[1] as TextBox;
19-
var Suggestion = values[0] as TextBox;
20-
Suggestion.CaretIndex = QueryText.CaretIndex;
21-
Suggestion.ScrollToHorizontalOffset(QueryText.HorizontalOffset);
18+
var QueryText = values[0] as TextBox;
19+
2220

2321
// first prop is the current query string
2422
var queryText = QueryText.Text;
@@ -27,7 +25,7 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
2725
return string.Empty;
2826

2927
// second prop is the current selected item result
30-
var val = values[2];
28+
var val = values[1];
3129
if (val == null)
3230
{
3331
return string.Empty;
@@ -45,7 +43,7 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
4543
var selectedResultActionKeyword = string.IsNullOrEmpty(selectedResult.ActionKeywordAssigned) ? "" : selectedResult.ActionKeywordAssigned + " ";
4644
var selectedResultPossibleSuggestion = selectedResultActionKeyword + selectedResult.Title;
4745

48-
if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase))
46+
if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase) || QueryText.HorizontalOffset != 0)
4947
return string.Empty;
5048

5149
// When user typed lower case and result title is uppercase, we still want to display suggestion

Flow.Launcher/MainWindow.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@
161161
Style="{DynamicResource QuerySuggestionBoxStyle}">
162162
<TextBox.Text>
163163
<MultiBinding Converter="{StaticResource QuerySuggestionBoxConverter}">
164-
<Binding RelativeSource="{RelativeSource self}" Mode="OneTime" />
165164
<Binding ElementName="QueryTextBox" Mode="OneTime" />
166165
<Binding ElementName="ResultListBox" Path="SelectedItem" />
167166
</MultiBinding>

0 commit comments

Comments
 (0)