Skip to content

Commit 22e7c54

Browse files
committed
Fixed: Double results no longer returned
When searching for text associated with a shortcut, a window is no longer returned twice for matching with both the shortcut text and the actual search text
1 parent e27c57e commit 22e7c54

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Window Walker/Window Walker/MainWindow.xaml.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ private void TextChangedEvent(object sender, TextChangedEventArgs e)
7676
public void SearchResultUpdateHandler(object sender, WindowWalker.Components.Window.WindowListUpdateEventArgs e)
7777
{
7878
this.Dispatcher.Invoke(() =>
79-
{
80-
79+
{
8180
resultsListBox.Items.Clear();
8281

8382
var windowsResult = WindowSearchController.Instance.SearchMatches.Where(x => x.ResultWindow.Hwnd != this.handleToMainWindow);
@@ -93,10 +92,21 @@ public void SearchResultUpdateHandler(object sender, WindowWalker.Components.Win
9392
windowResultsByType.Add(windowsShortcutResults.ToList());
9493
windowResultsByType.Add(windowsFuzzyResults.ToList());
9594

95+
Dictionary<IntPtr, bool> windowsAlreadyDisplayed = new Dictionary<IntPtr, bool>();
96+
9697
foreach (var windowsResultForType in windowResultsByType)
9798
{
9899
foreach (WindowSearchResult windowResult in windowsResultForType)
99100
{
101+
if (windowsAlreadyDisplayed.ContainsKey(windowResult.ResultWindow.Hwnd))
102+
{
103+
continue;
104+
}
105+
else
106+
{
107+
windowsAlreadyDisplayed[windowResult.ResultWindow.Hwnd] = true;
108+
}
109+
100110
/// Each window is shown in a horizontal stack panel
101111
/// that contains an image object on the left and
102112
/// a textblock with the window title on the right

0 commit comments

Comments
 (0)