From 4c0057e66af505d10dc5c4b8263f3235e2f96d31 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Fri, 13 Aug 2010 14:37:26 -0400 Subject: [PATCH] Undoing this change since it is no longer necessary due to an alternative solution implemented by Ross Boucher. Revert "Merge commit 'c17a3533ecae63d479b285b23ac3a490ebe8bd3c'" This reverts commit 039f2ce449fe4767ffb5991b76732c7db5794fc4, reversing changes made to 494f39dd86cd1598cc3f2577aa7b419633f06d5e. --- AppKit/CPArrayController.j | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/AppKit/CPArrayController.j b/AppKit/CPArrayController.j index 6843f79c6..b04f4e0f9 100644 --- a/AppKit/CPArrayController.j +++ b/AppKit/CPArrayController.j @@ -407,23 +407,16 @@ if (_filterPredicate === nil || [_filterPredicate evaluateWithObject:object]) { - var position; - if ([_sortDescriptors count] > 0) - position = [_arrangedObjects insertObject:object inArraySortedByDescriptors:_sortDescriptors]; - else - { - [_arrangedObjects addObject:object]; - position = [_arrangedObjects count] - 1; - } + var pos = [_arrangedObjects insertObject:object inArraySortedByDescriptors:_sortDescriptors]; if (_selectsInsertedObjects) { - [self setSelectionIndex:position]; + [self setSelectionIndex:pos]; } else { [self willChangeValueForKey:@"selectionIndexes"]; - [_selectionIndexes shiftIndexesStartingAtIndex:position by:1]; + [_selectionIndexes shiftIndexesStartingAtIndex:pos by:1]; [self didChangeValueForKey:@"selectionIndexes"]; } }