From 5c241d7491f4d638dff327ea4c1bf3ff9a513db8 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 20 Jan 2026 21:47:38 +1100 Subject: [PATCH] fix to respect max history result shown setting --- Flow.Launcher/ViewModel/MainViewModel.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 504ede103..b51a8f8cf 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1316,19 +1316,13 @@ namespace Flow.Launcher.ViewModel } } - private List GetHistoryItems(IEnumerable historyItems, int? selectLast = null) + private List GetHistoryItems(IEnumerable historyItems, int? maxResult = null) { var results = new List(); // 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);