mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Keep window open after closing last tab. Fixes #24.
When the last tab is closed the window will be kept open if the file browser is shown. It will close the existing document and replace it with a scratch document.
This commit is contained in:
committed by
Allan Odgaard
parent
b9d8d61298
commit
dc37506831
@@ -943,6 +943,23 @@ NSString* const kUserDefaultsFileBrowserPlacementKey = @"fileBrowserPlacement";
|
||||
{
|
||||
D(DBF_DocumentController, bug("\n"););
|
||||
ASSERT([sender isKindOfClass:[OakTabBarView class]]);
|
||||
|
||||
if(documentTabs.size() == 1 && !fileBrowserHidden)
|
||||
{
|
||||
document::document_ptr document = *documentTabs[0];
|
||||
if(!document->is_modified())
|
||||
{
|
||||
if(document->path() == NULL_STR)
|
||||
{
|
||||
return [[self window] performClose:self];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self newDocumentInTab:nil];
|
||||
scratchDocument = [self selectedDocument]->identifier();
|
||||
}
|
||||
}
|
||||
}
|
||||
[self closeTabsAtIndexes:[NSIndexSet indexSetWithIndex:[sender tag]] quiet:NO];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user