mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-22 20:37:19 -08:00
optimize<PageTabBar>: move to previous one when the last tab is closed
This commit is contained in:
parent
fa4cec87e0
commit
6b602e70c5
1 changed files with 4 additions and 2 deletions
|
@ -127,7 +127,8 @@ namespace SourceGit.Views.Widgets {
|
|||
Tabs.Remove(curTab);
|
||||
RaiseEvent(new TabEventArgs(TabClosedEvent, this, curTab.Id));
|
||||
|
||||
var next = Tabs[idx % Tabs.Count];
|
||||
var last = Tabs.Count - 1;
|
||||
var next = idx > last ? Tabs[last] : Tabs[idx];
|
||||
container.SelectedItem = next;
|
||||
RaiseEvent(new TabEventArgs(TabSelectedEvent, this, next.Id));
|
||||
}
|
||||
|
@ -171,7 +172,8 @@ namespace SourceGit.Views.Widgets {
|
|||
var idx = Tabs.IndexOf(tab);
|
||||
Tabs.Remove(tab);
|
||||
|
||||
var next = Tabs[idx % Tabs.Count];
|
||||
var last = Tabs.Count - 1;
|
||||
var next = idx > last ? Tabs[last] : Tabs[idx];
|
||||
container.SelectedItem = next;
|
||||
RaiseEvent(new TabEventArgs(TabSelectedEvent, this, next.Id));
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue