From 79b0f7a14a0bbda1eb685d2edc98641c4dc96e32 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Tue, 18 Sep 2012 17:29:33 +0200 Subject: [PATCH] Setup scope attributes for untitled documents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are based on the potential save directory (i.e. the one showing in the file browser) and ensures pressing ⌥⌘N gives the new document proper project and SCM scopes (so ⌘Y and ⌘B works as expected). This fixes issue #367. --- Frameworks/DocumentWindow/src/DocumentController.mm | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Frameworks/DocumentWindow/src/DocumentController.mm b/Frameworks/DocumentWindow/src/DocumentController.mm index 3a257043..a4737665 100644 --- a/Frameworks/DocumentWindow/src/DocumentController.mm +++ b/Frameworks/DocumentWindow/src/DocumentController.mm @@ -118,6 +118,7 @@ OAK_DEBUG_VAR(DocumentController); @interface DocumentController () @property (nonatomic, retain) OakFilterWindowController* filterWindowController; +@property (nonatomic, retain) NSString* pathAttributes; @end @interface OakUnhideHelper : NSObject @@ -534,6 +535,7 @@ OAK_DEBUG_VAR(DocumentController); self.windowTitle = [NSString stringWithCxxString:settings.get(kSettingsWindowTitleKey, doc->display_name())]; self.representedFile = [NSString stringWithCxxString:doc->path()]; self.isDocumentEdited = doc->is_modified(); + self.pathAttributes = [NSString stringWithCxxString:file::path_attributes(doc->path(), docDirectory)]; } - (void)updateProxyIcon @@ -620,14 +622,7 @@ OAK_DEBUG_VAR(DocumentController); - (NSString*)scopeAttributes { - if(selectedTabIndex >= documentTabs.size()) - { - fprintf(stderr, "*** error: selected tab out of bounds: %zu >= %zu\n", selectedTabIndex, documentTabs.size()); - return nil; - } - - document::document_ptr doc = [self selectedDocument]; - return doc ? [NSString stringWithCxxString:doc->path_attributes()] : nil; + return self.pathAttributes; } // =============================