mirror of
https://github.com/textmate/textmate.git
synced 2026-01-22 13:17:55 -05:00
Proper implementation of setChoices:
This will now reload the table view and resize the pop-up (if necessary).
This commit is contained in:
@@ -75,6 +75,21 @@ enum action_t { kActionNop, kActionTab, kActionReturn, kActionCancel, kActionMov
|
||||
return choiceIndex == NSNotFound ? nil : [choices objectAtIndex:choiceIndex];
|
||||
}
|
||||
|
||||
- (void)setChoices:(NSArray*)newChoices
|
||||
{
|
||||
if([choices isEqualToArray:newChoices])
|
||||
return;
|
||||
|
||||
id oldSelection = self.selectedChoice;
|
||||
self.choiceIndex = NSNotFound;
|
||||
[choices autorelease];
|
||||
choices = [newChoices retain];
|
||||
[tableView reloadData];
|
||||
self.choiceIndex = [choices indexOfObject:oldSelection];
|
||||
|
||||
[self sizeToFit];
|
||||
}
|
||||
|
||||
- (void)setChoiceIndex:(NSUInteger)newIndex
|
||||
{
|
||||
if(choiceIndex != newIndex)
|
||||
|
||||
Reference in New Issue
Block a user