From 4a6cbddeac9dfcd3ed673d2d7aabd28f6b8182ef Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 30 Oct 2024 09:53:58 +0800 Subject: [PATCH] refactor: select the previous tab while closing the actived one (#621) Signed-off-by: leo --- src/ViewModels/Launcher.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index dd618e41..8e4f7775 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -204,12 +204,7 @@ namespace SourceGit.ViewModels var activeIdx = Pages.IndexOf(_activePage); if (removeIdx == activeIdx) { - ActivePage = Pages[removeIdx == Pages.Count - 1 ? removeIdx - 1 : removeIdx + 1]; - CloseRepositoryInTab(page); - Pages.RemoveAt(removeIdx); - } - else if (removeIdx + 1 == activeIdx) - { + ActivePage = Pages[removeIdx > 0 ? removeIdx - 1 : removeIdx + 1]; CloseRepositoryInTab(page); Pages.RemoveAt(removeIdx); }