refactor: select the previous tab while closing the actived one (#621)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-10-30 09:53:58 +08:00
parent b175ab3a3e
commit 4a6cbddeac
No known key found for this signature in database

View file

@ -204,12 +204,7 @@ namespace SourceGit.ViewModels
var activeIdx = Pages.IndexOf(_activePage); var activeIdx = Pages.IndexOf(_activePage);
if (removeIdx == activeIdx) if (removeIdx == activeIdx)
{ {
ActivePage = Pages[removeIdx == Pages.Count - 1 ? removeIdx - 1 : removeIdx + 1]; ActivePage = Pages[removeIdx > 0 ? removeIdx - 1 : removeIdx + 1];
CloseRepositoryInTab(page);
Pages.RemoveAt(removeIdx);
}
else if (removeIdx + 1 == activeIdx)
{
CloseRepositoryInTab(page); CloseRepositoryInTab(page);
Pages.RemoveAt(removeIdx); Pages.RemoveAt(removeIdx);
} }