@@ -210,14 +210,22 @@ private void LoadHistory()
210210 }
211211
212212 [ RelayCommand ]
213- private void ReQuery ( )
213+ public void ReQuery ( )
214214 {
215215 if ( SelectedIsFromQueryResults ( ) )
216216 {
217217 QueryResults ( isReQuery : true ) ;
218218 }
219219 }
220220
221+ public void ReQuery ( bool reselect )
222+ {
223+ if ( SelectedIsFromQueryResults ( ) )
224+ {
225+ QueryResults ( isReQuery : true , reSelect : reselect ) ;
226+ }
227+ }
228+
221229 [ RelayCommand ]
222230 private void LoadContextMenu ( )
223231 {
@@ -775,7 +783,7 @@ private void QueryHistory()
775783
776784 private readonly IReadOnlyList < Result > _emptyResult = new List < Result > ( ) ;
777785
778- private async void QueryResults ( bool isReQuery = false )
786+ private async void QueryResults ( bool isReQuery = false , bool reSelect = true )
779787 {
780788 _updateSource ? . Cancel ( ) ;
781789
@@ -850,7 +858,7 @@ private async void QueryResults(bool isReQuery = false)
850858
851859 var tasks = plugins . Select ( plugin => plugin . Metadata . Disabled switch
852860 {
853- false => QueryTask ( plugin ) ,
861+ false => QueryTask ( plugin , reSelect ) ,
854862 true => Task . CompletedTask
855863 } ) . ToArray ( ) ;
856864
@@ -878,7 +886,7 @@ private async void QueryResults(bool isReQuery = false)
878886 }
879887
880888 // Local function
881- async Task QueryTask ( PluginPair plugin )
889+ async Task QueryTask ( PluginPair plugin , bool reSelect = true )
882890 {
883891 // Since it is wrapped within a ThreadPool Thread, the synchronous context is null
884892 // Task.Yield will force it to run in ThreadPool
@@ -892,7 +900,7 @@ async Task QueryTask(PluginPair plugin)
892900 results ??= _emptyResult ;
893901
894902 if ( ! _resultsUpdateChannelWriter . TryWrite ( new ResultsForUpdate ( results , plugin . Metadata , query ,
895- currentCancellationToken ) ) )
903+ currentCancellationToken , reSelect ) ) )
896904 {
897905 Log . Error ( "MainViewModel" , "Unable to add item to Result Update Queue" ) ;
898906 }
@@ -1133,7 +1141,7 @@ public void Save()
11331141 /// <summary>
11341142 /// To avoid deadlock, this method should not called from main thread
11351143 /// </summary>
1136- public void UpdateResultView ( IEnumerable < ResultsForUpdate > resultsForUpdates )
1144+ public void UpdateResultView ( ICollection < ResultsForUpdate > resultsForUpdates )
11371145 {
11381146 if ( ! resultsForUpdates . Any ( ) )
11391147 return ;
@@ -1172,7 +1180,10 @@ public void UpdateResultView(IEnumerable<ResultsForUpdate> resultsForUpdates)
11721180 }
11731181 }
11741182
1175- Results . AddResults ( resultsForUpdates , token ) ;
1183+ // it should be the same for all results
1184+ bool reSelect = resultsForUpdates . First ( ) . ReSelectFirstResult ;
1185+
1186+ Results . AddResults ( resultsForUpdates , token , reSelect ) ;
11761187 }
11771188
11781189 #endregion
0 commit comments