mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
History fileview: select current item on rightclick
This commit is contained in:
committed by
Pieter de Bie
parent
ad2213ce2f
commit
d04362ba82
@@ -58,6 +58,25 @@
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
- (NSMenu *)menuForEvent:(NSEvent *)theEvent
|
||||
{
|
||||
if ([theEvent type] == NSRightMouseDown)
|
||||
{
|
||||
// get the current selections for the outline view.
|
||||
NSIndexSet *selectedRowIndexes = [self selectedRowIndexes];
|
||||
|
||||
// select the row that was clicked before showing the menu for the event
|
||||
NSPoint mousePoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
int row = [self rowAtPoint:mousePoint];
|
||||
|
||||
// figure out if the row that was just clicked on is currently selected
|
||||
if ([selectedRowIndexes containsIndex:row] == NO)
|
||||
[self selectRow:row byExtendingSelection:NO];
|
||||
}
|
||||
|
||||
return [super menuForEvent:theEvent];
|
||||
}
|
||||
|
||||
/* Implemented to satisfy datasourcee protocol */
|
||||
- (BOOL) outlineView: (NSOutlineView *)ov
|
||||
isItemExpandable: (id)item { return NO; }
|
||||
|
||||
Reference in New Issue
Block a user