mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix issue when querying history items in home page
This commit is contained in:
parent
58d910dc57
commit
f22b6449d4
1 changed files with 10 additions and 5 deletions
|
|
@ -1322,12 +1322,19 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private List<Result> GetHistoryItems(IEnumerable<LastOpenedHistoryResult> historyItems)
|
||||
private List<Result> GetHistoryItems(IEnumerable<LastOpenedHistoryResult> historyItems, int? selectLast = null)
|
||||
{
|
||||
var results = new List<Result>();
|
||||
|
||||
// Order by executed time descending: Latest -> Oldest
|
||||
historyItems = historyItems.OrderByDescending(x => x.ExecutedDateTime);
|
||||
|
||||
// Select the last N items if specified
|
||||
if (selectLast.HasValue)
|
||||
{
|
||||
historyItems = historyItems.Take(selectLast.Value);
|
||||
}
|
||||
|
||||
if (Settings.HistoryStyle == HistoryStyle.LastOpened)
|
||||
{
|
||||
// Items saved to disk are differentiated by Query also, but LastOpened style only cares about unique results
|
||||
|
|
@ -1637,10 +1644,8 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
void QueryHistoryTask(CancellationToken token)
|
||||
{
|
||||
// Select last history results and revert its order to make sure last history results are on top
|
||||
var historyItems = _history.LastOpenedHistoryItems.TakeLast(Settings.MaxHistoryResultsToShowForHomePage).Reverse();
|
||||
|
||||
var results = GetHistoryItems(historyItems);
|
||||
// Select last history results
|
||||
var results = GetHistoryItems(_history.LastOpenedHistoryItems, Settings.MaxHistoryResultsToShowForHomePage);
|
||||
|
||||
if (token.IsCancellationRequested) return;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue