Browse Source

Fix #3734: Search pane flickers when navigating to search result in large assembly

pull/3735/merge
Christoph Wille 1 week ago committed by GitHub
parent
commit
b67ba16f69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 15
      ILSpy/Search/SearchPane.xaml.cs

15
ILSpy/Search/SearchPane.xaml.cs

@ -19,6 +19,7 @@ @@ -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 @@ namespace ICSharpCode.ILSpy.Search @@ -75,14 +76,24 @@ namespace ICSharpCode.ILSpy.Search
InitializeComponent();
ContextMenuProvider.Add(listBox);
MessageBus<CurrentAssemblyListChangedEventArgs>.Subscribers += (sender, e) => CurrentAssemblyList_Changed();
MessageBus<CurrentAssemblyListChangedEventArgs>.Subscribers += (sender, e) => CurrentAssemblyList_Changed(e);
MessageBus<SettingsChangedEventArgs>.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<T>
System.Collections.Specialized.NotifyCollectionChangedEventArgs collectionChange = e;
if (collectionChange.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add
&& collectionChange.NewItems?.Cast<LoadedAssembly>().All(asm => asm.IsAutoLoaded) == true)
{
return;
}
if (IsVisible)
{
StartSearch(this.SearchTerm);

Loading…
Cancel
Save