mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Do not restore project state for projects with no documents
The state being restored here would be file browser state, which might confuse the user if they are opening a folder via “mate” and then get a file browser restored for that project folder that show another location than the actual folder they open. The reason we ignore the state when loading, rather than not saving it in the first place, is that by saving the state we make the folder show up in File → Open Favorites…
This commit is contained in:
@@ -2668,8 +2668,11 @@ static NSUInteger DisableSessionSavingCount = 0;
|
||||
else if(controller.selectedDocument)
|
||||
[controller selectedDocument]->set_custom_name("not untitled"); // release potential untitled token used
|
||||
|
||||
BOOL disableFolderStateRestore = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableFolderStateRestore];
|
||||
if(NSDictionary* project = (disableFolderStateRestore ? nil : [[DocumentController sharedProjectStateDB] valueForKey:[NSString stringWithCxxString:folder]]))
|
||||
NSDictionary* project;
|
||||
if(![[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableFolderStateRestore])
|
||||
project = [[DocumentController sharedProjectStateDB] valueForKey:[NSString stringWithCxxString:folder]];
|
||||
|
||||
if(project && [project[@"documents"] count])
|
||||
{
|
||||
[controller setupControllerForProject:project skipMissingFiles:YES];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user