diff --git a/ILSpy/Search/SearchPane.xaml.cs b/ILSpy/Search/SearchPane.xaml.cs index 206417a980..668787c353 100644 --- a/ILSpy/Search/SearchPane.xaml.cs +++ b/ILSpy/Search/SearchPane.xaml.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Linq; using System.Collections.ObjectModel; using System.ComponentModel; using System.Composition; @@ -75,14 +76,24 @@ public SearchPane(AssemblyTreeModel assemblyTreeModel, ITreeNodeFactory treeNode InitializeComponent(); ContextMenuProvider.Add(listBox); - MessageBus.Subscribers += (sender, e) => CurrentAssemblyList_Changed(); + MessageBus.Subscribers += (sender, e) => CurrentAssemblyList_Changed(e); MessageBus.Subscribers += (sender, e) => Settings_PropertyChanged(sender, e); CompositionTarget.Rendering += UpdateResults; } - void CurrentAssemblyList_Changed() + void CurrentAssemblyList_Changed(CurrentAssemblyListChangedEventArgs e) { + // Don't restart the search when only auto-loaded (dependency) assemblies are added; + // this avoids flickering when navigating to a result in a large assembly. + // Explicit variable assignment necessary bc implicit operator T on WrappedEventArgs + System.Collections.Specialized.NotifyCollectionChangedEventArgs collectionChange = e; + if (collectionChange.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add + && collectionChange.NewItems?.Cast().All(asm => asm.IsAutoLoaded) == true) + { + return; + } + if (IsVisible) { StartSearch(this.SearchTerm);