From a4be5c8a785c9af8c91ddbc619d9057682ebe5d5 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 7 Jun 2017 11:13:12 -0300 Subject: [PATCH] Fix being able to start typing something, change other filters, and have the search use the currently typing query --- osu.Game/Overlays/DirectOverlay.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index a487bc6af3..c2c7c0e306 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -116,7 +116,11 @@ namespace osu.Game.Overlays Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; }; Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; }; - Filter.Search.OnCommit = (sender, text) => updateSets(); + Filter.Search.OnCommit = (sender, text) => + { + lastQuery = Filter.Search.Text; + updateSets(); + }; ((FilterControl)Filter).Ruleset.ValueChanged += ruleset => updateSets(); Filter.Tabs.Current.ValueChanged += sortCriteria => updateSets(); Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; @@ -155,6 +159,7 @@ namespace osu.Game.Overlays } private GetBeatmapSetsRequest getSetsRequest; + private string lastQuery; private void updateSets() { if (!IsLoaded) return; @@ -164,7 +169,7 @@ namespace osu.Game.Overlays if (api == null || Filter.Search.Text == string.Empty) return; - getSetsRequest = new GetBeatmapSetsRequest(Filter.Search.Text, + getSetsRequest = new GetBeatmapSetsRequest(lastQuery, ((FilterControl)Filter).Ruleset.Value, Filter.DisplayStyleControl.Dropdown.Current.Value, Filter.Tabs.Current.Value); //todo: sort direction