diff options
Diffstat (limited to 'src/ui/util.c')
-rw-r--r-- | src/ui/util.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 9a023ab9..a1d76709 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -922,8 +922,19 @@ static iBool tabSwitcher_(iWidget *tabs, const char *cmd) { | |||
922 | if (isVisible_Widget(child)) break; | 922 | if (isVisible_Widget(child)) break; |
923 | tabIndex++; | 923 | tabIndex++; |
924 | } | 924 | } |
925 | tabIndex += (equal_Command(cmd, "tabs.next") ? +1 : -1); | 925 | const int dir = (equal_Command(cmd, "tabs.next") ? +1 : -1); |
926 | showTabPage_Widget(tabs, child_Widget(pages, iWrap(tabIndex, 0, childCount_Widget(pages)))); | 926 | /* If out of tabs, rotate to the next set of tabs if one is available. */ |
927 | if ((tabIndex == 0 && dir < 0) || (tabIndex == childCount_Widget(pages) - 1 && dir > 0)) { | ||
928 | iWidget *nextTabs = findChild_Widget(otherRoot_Window(get_Window(), tabs->root)->widget, | ||
929 | "doctabs"); | ||
930 | iWidget *nextPages = findChild_Widget(nextTabs, "tabs.pages"); | ||
931 | tabIndex = (dir < 0 ? childCount_Widget(nextPages) - 1 : 0); | ||
932 | showTabPage_Widget(nextTabs, child_Widget(nextPages, tabIndex)); | ||
933 | postCommand_App("keyroot.next"); | ||
934 | } | ||
935 | else { | ||
936 | showTabPage_Widget(tabs, child_Widget(pages, tabIndex + dir)); | ||
937 | } | ||
927 | refresh_Widget(tabs); | 938 | refresh_Widget(tabs); |
928 | return iTrue; | 939 | return iTrue; |
929 | } | 940 | } |