Moving focus to file browser now select first item

This is only when using the special Navigate → Move Focus to File Browser (⌥⌘⇥) command and is mainly because there is no other visual feedback (other than the text view being rendered in its inactive state).

I could see sometimes not wanting a selection in the file browser, this however seems like a general problem (i.e. the solution should likely be to introduce a way to “deselect all”).
This commit is contained in:
Allan Odgaard
2013-02-08 12:30:01 +01:00
parent deac51c7a1
commit 9c42d1ae9f

View File

@@ -311,7 +311,18 @@ namespace
if([self.window firstResponder] == self.textView)
{
self.fileBrowserVisible = YES;
[self.window makeFirstResponder:self.fileBrowser.outlineView];
NSOutlineView* outlineView = self.fileBrowser.outlineView;
[self.window makeFirstResponder:outlineView];
if([outlineView numberOfSelectedRows] == 0)
{
for(NSUInteger row = 0; row < [outlineView numberOfRows]; ++row)
{
if([[outlineView delegate] respondsToSelector:@selector(outlineView:isGroupItem:)] && [[outlineView delegate] outlineView:outlineView isGroupItem:[outlineView itemAtRow:row]])
continue;
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
break;
}
}
}
else
{