From e45f7df622a11a380bd1572f3002f28457831131 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 9 Jul 2022 15:46:19 +0200 Subject: [PATCH] Ensure to not duplicate the latest project in history Closes #20 --- I18N Commander/UI WinForms/Components/LoaderStart.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/I18N Commander/UI WinForms/Components/LoaderStart.cs b/I18N Commander/UI WinForms/Components/LoaderStart.cs index ad55a5f..00726f7 100644 --- a/I18N Commander/UI WinForms/Components/LoaderStart.cs +++ b/I18N Commander/UI WinForms/Components/LoaderStart.cs @@ -43,7 +43,15 @@ public partial class LoaderStart : UserControl private static void UpdateRecentProjectsWithPruning(string latestUsedProjectPath) { var previousRecentList = LoaderStart.RecentProjects; + + // Check, if the latest project is identical to the next project we open. In that case, we don't add it to the list. + if (previousRecentList.Any() && previousRecentList[0] == latestUsedProjectPath) + return; + + // Add the next project to the list: previousRecentList.Insert(0, latestUsedProjectPath); + + // Prune the list: if (previousRecentList.Count > 6) previousRecentList = previousRecentList.Take(6).ToList();