mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
fix to respect max history result shown setting
This commit is contained in:
parent
90360022a4
commit
5c241d7491
1 changed files with 5 additions and 7 deletions
|
|
@ -1316,19 +1316,13 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Result> GetHistoryItems(IEnumerable<LastOpenedHistoryResult> historyItems, int? selectLast = null)
|
private List<Result> GetHistoryItems(IEnumerable<LastOpenedHistoryResult> historyItems, int? maxResult = null)
|
||||||
{
|
{
|
||||||
var results = new List<Result>();
|
var results = new List<Result>();
|
||||||
|
|
||||||
// Order by executed time descending: Latest -> Oldest
|
// Order by executed time descending: Latest -> Oldest
|
||||||
historyItems = historyItems.OrderByDescending(x => x.ExecutedDateTime);
|
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)
|
if (Settings.HistoryStyle == HistoryStyle.LastOpened)
|
||||||
{
|
{
|
||||||
// Items saved to disk are differentiated by Query also, but LastOpened style only cares about unique results
|
// Items saved to disk are differentiated by Query also, but LastOpened style only cares about unique results
|
||||||
|
|
@ -1337,6 +1331,10 @@ namespace Flow.Launcher.ViewModel
|
||||||
.Select(g => g.First());
|
.Select(g => g.First());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Max history results to return for display
|
||||||
|
if (maxResult.HasValue)
|
||||||
|
historyItems = historyItems.Take(maxResult.Value);
|
||||||
|
|
||||||
foreach (var item in historyItems)
|
foreach (var item in historyItems)
|
||||||
{
|
{
|
||||||
var copiedItem = item.DeepCopyForHistoryStyle(Settings.HistoryStyle == HistoryStyle.LastOpened);
|
var copiedItem = item.DeepCopyForHistoryStyle(Settings.HistoryStyle == HistoryStyle.LastOpened);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue