diff options
-rw-r--r-- | PreferencesController.m | 13 | ||||
-rw-r--r-- | ScrollingTextView.h | 2 | ||||
-rw-r--r-- | WorldStatusController.m | 5 |
3 files changed, 11 insertions, 9 deletions
diff --git a/PreferencesController.m b/PreferencesController.m index 1852adb..cba6241 100644 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -55,18 +55,17 @@ - (IBAction)removeStartupWorld: (id)sender { - NSEnumerator *rowEnum; + NSIndexSet *selectedIndexes; NSMutableArray *newStartupItems; - NSNumber *row; - int removedRows; + __block int removedRows; newStartupItems = [[[NSUserDefaults standardUserDefaults] startupWorlds] mutableCopy]; removedRows = 0; - rowEnum = [theStartupItemsTableView selectedRowEnumerator]; - while ((row = [rowEnum nextObject]) != nil) { - [newStartupItems removeObjectAtIndex: [row intValue]-removedRows]; + selectedIndexes = [theStartupItemsTableView selectedRowIndexes]; + [selectedIndexes enumerateIndexesUsingBlock: ^(NSUInteger idx, BOOL *stop) { + [newStartupItems removeObjectAtIndex: idx-removedRows]; removedRows++; - } + }]; [[NSUserDefaults standardUserDefaults] setStartupWorlds: newStartupItems]; [self refreshStartupTableView]; } diff --git a/ScrollingTextView.h b/ScrollingTextView.h index b917bff..2dbab1a 100644 --- a/ScrollingTextView.h +++ b/ScrollingTextView.h @@ -2,7 +2,7 @@ #import <Cocoa/Cocoa.h> -@interface ScrollingTextView : NSTextView +@interface ScrollingTextView : NSTextView <NSLayoutManagerDelegate> { IBOutlet NSResponder *theResponder; } diff --git a/WorldStatusController.m b/WorldStatusController.m index f931055..3fd9dfb 100644 --- a/WorldStatusController.m +++ b/WorldStatusController.m @@ -137,12 +137,15 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn - (void)selectWorld: (World *)aWorld { NSArray *worlds; + NSIndexSet *rowIndexes; int row; if (aWorld) { worlds = [[NSDocumentController sharedDocumentController] documents]; row = [worlds indexOfObject: aWorld]; - [theTableView selectRow: row byExtendingSelection: NO]; + rowIndexes = [NSIndexSet indexSetWithIndex: row]; + [theTableView selectRowIndexes: rowIndexes + byExtendingSelection: NO]; } else [theTableView deselectAll: self]; } |