diff options
author | Lluis Sanchez <llsan@microsoft.com> | 2019-09-13 14:04:18 +0300 |
---|---|---|
committer | Lluis Sanchez <llsan@microsoft.com> | 2019-09-13 14:04:18 +0300 |
commit | 731915e557e92dfe7333a1fab6cd37335aae1583 (patch) | |
tree | 306917483f48518d2efd6719e73a0f3eafc19aac /main/src | |
parent | 1f192022eadadc5f21039759ec947b940fd6cc66 (diff) |
Fix flickering issue in results window
Avoid refresing the search results window too often.
Fixes bug #972204 - Too much flickering while typing in searchbar
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs index f32af88497..1dbbf38fe9 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs @@ -458,14 +458,16 @@ namespace MonoDevelop.Components.MainToolbar col.Task = cat.GetResults (col, pattern, token); //we append on finished to process and show the results - col.Task.ContinueWith ((colTask) => { + col.Task.ContinueWith (async (colTask) => { //cancel last provider continueWith task lastProvSrc?.Cancel (); if (token.IsCancellationRequested || colTask.IsCanceled) return; - + + await nextUpdate; + lock (lockObject) { current++; @@ -522,6 +524,8 @@ namespace MonoDevelop.Components.MainToolbar return; OnPreferredSizeChanged (); + + nextUpdate = Task.Delay (250); }).Ignore (); } }, token, TaskContinuationOptions.NotOnCanceled, TaskScheduler.Default) @@ -529,6 +533,8 @@ namespace MonoDevelop.Components.MainToolbar } } + Task nextUpdate = Task.CompletedTask; + readonly object lockObject = new object (); (List<Tuple<SearchCategory, IReadOnlyList<SearchResult>>> failedResults, ItemIdentifier topResult) GetTopResult (List<Tuple<SearchCategory, IReadOnlyList<SearchResult>>> newResults) |