Skip to content
This repository was archived by the owner on Nov 19, 2019. It is now read-only.

Commit b322130

Browse files
author
Michael Ehrmann
committed
[CHANGE] selecting a tab from overflow popup just inserts the selected tab at last visible index, this should behave more like the OS does.
1 parent 963884e commit b322130

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Source/PSMTabBarControl.m

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,15 +1998,22 @@ - (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabV
19981998
id tempDelegate = [aTabView delegate];
19991999
[aTabView setDelegate:nil];
20002000

2001+
PSMTabBarCell *lastVisibleCell = self.lastVisibleTab;
2002+
NSUInteger *lastVisibleCellIndex = [self.cells indexOfObject:lastVisibleCell];
2003+
20012004
// move it all around first
20022005
[tabViewItem retain];
20032006
[thisCell retain];
2007+
20042008
[aTabView removeTabViewItem:tabViewItem];
2005-
[aTabView insertTabViewItem:tabViewItem atIndex:0];
2009+
[aTabView insertTabViewItem:tabViewItem atIndex:lastVisibleCellIndex];
2010+
20062011
[self removeCellAtIndex:(NSUInteger)tabIndex];
2007-
[self insertCell:thisCell atIndex:0];
2008-
[thisCell setIsInOverflowMenu:NO]; //very important else we get a fun recursive loop going
2009-
[[_cells objectAtIndex:[_cells count] - 1] setIsInOverflowMenu:YES]; //these 2 lines are pretty uncool and this logic needs to be updated
2012+
[self insertCell:thisCell atIndex:lastVisibleCellIndex];
2013+
2014+
[thisCell setIsInOverflowMenu:NO]; // very important else we get a fun recursive loop going
2015+
[lastVisibleCell setIsInOverflowMenu:YES]; // now the former lastVisible Cell goes into the overflow popup
2016+
20102017
[thisCell release];
20112018
[tabViewItem release];
20122019

0 commit comments

Comments
 (0)