Don’t scroll selected item to top in choice menu

We now only ensure it is scrolled into the visible area.
This commit is contained in:
Allan Odgaard
2012-09-04 18:17:43 +02:00
parent b136fcbca4
commit 141c0bd525

View File

@@ -97,16 +97,12 @@ enum action_t { kActionNop, kActionTab, kActionReturn, kActionCancel, kActionMov
choiceIndex = newIndex;
if(choiceIndex == NSNotFound)
{
NSInteger selectedRow = [tableView selectedRow];
if(selectedRow != -1)
[tableView deselectRow:selectedRow];
[tableView deselectAll:self];
}
else
{
[tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:choiceIndex] byExtendingSelection:NO];
NSRect rowRect = [tableView rectOfRow:choiceIndex];
rowRect.size.height = NSHeight([tableView visibleRect]);
[tableView scrollRectToVisible:NSIntersectionRect(rowRect, [tableView bounds])];
[tableView scrollRectToVisible:[tableView rectOfRow:choiceIndex]];
}
}
}