fix to respect max history result shown setting

This commit is contained in:
Jeremy 2026-01-20 21:47:38 +11:00
parent 90360022a4
commit 5c241d7491

View file

@ -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>();
// 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
@ -1337,6 +1331,10 @@ namespace Flow.Launcher.ViewModel
.Select(g => g.First());
}
// Max history results to return for display
if (maxResult.HasValue)
historyItems = historyItems.Take(maxResult.Value);
foreach (var item in historyItems)
{
var copiedItem = item.DeepCopyForHistoryStyle(Settings.HistoryStyle == HistoryStyle.LastOpened);