From cf1b4750e4e17d5ea653c4d20d6ed4b151a17fbd Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Fri, 17 Aug 2012 23:01:11 +0200 Subject: [PATCH] Go to Current Document is now a toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also works as a (quick) way to deselect all in the file browser (i.e. hit ⌃⌘R twice) which is useful when one wants to run commands on the entire project (e.g. Git → Show Uncommitted Changes). --- Frameworks/DocumentWindow/src/DocumentController.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Frameworks/DocumentWindow/src/DocumentController.mm b/Frameworks/DocumentWindow/src/DocumentController.mm index b2365465..39758e2c 100644 --- a/Frameworks/DocumentWindow/src/DocumentController.mm +++ b/Frameworks/DocumentWindow/src/DocumentController.mm @@ -908,7 +908,10 @@ NSString* const kUserDefaultsFileBrowserPlacementKey = @"fileBrowserPlacement"; { D(DBF_DocumentController, bug("%s\n", [self selectedDocument]->path().c_str());); self.fileBrowserHidden = NO; - [fileBrowser showURL:[NSURL fileURLWithPath:[NSString stringWithCxxString:[self selectedDocument]->path()]]]; + NSURL* currentDocumentURL = [NSURL fileURLWithPath:[NSString stringWithCxxString:[self selectedDocument]->path()]]; + if([fileBrowser.selectedURLs count] == 1 && [currentDocumentURL isEqualTo:[fileBrowser.selectedURLs lastObject]]) + [fileBrowser deselectAll:self]; + else [fileBrowser showURL:currentDocumentURL]; } - (IBAction)goToProjectFolder:(id)sender