mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Select last added document when creating multiple tabs at once
When we close a tab then we select the tab to the left, for this reason it makes most sense to select the last tab added, so that ⌘W will effectively go to the “next tab inserted”. The exception is when we create a new project, here we select the first tab since there are no tabs to the left, so ⌘W will still work as a “next tab” button. Though I may later change this so that the behavior is consistent.
This commit is contained in:
@@ -983,8 +983,8 @@ namespace
|
||||
tabsToClose = [self disposableDocument];
|
||||
}
|
||||
|
||||
[self insertDocuments:documents atIndex:_selectedTabIndex + 1 selecting:documents.front() andClosing:tabsToClose];
|
||||
[self openAndSelectDocument:documents.front()];
|
||||
[self insertDocuments:documents atIndex:_selectedTabIndex + 1 selecting:documents.back() andClosing:tabsToClose];
|
||||
[self openAndSelectDocument:documents.back()];
|
||||
|
||||
if(self.tabBarView && ![[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableTabAutoCloseKey])
|
||||
{
|
||||
@@ -2743,7 +2743,8 @@ static NSUInteger DisableSessionSavingCount = 0;
|
||||
static DocumentController* controller_with_documents (std::vector<document::document_ptr> const& documents, oak::uuid_t const& projectUUID = document::kCollectionAny)
|
||||
{
|
||||
DocumentController* controller = find_or_create_controller(documents, projectUUID);
|
||||
[controller insertDocuments:documents atIndex:controller.selectedTabIndex + 1 selecting:documents.front() andClosing:[controller disposableDocument]];
|
||||
auto documentToSelect = controller.documents.size() <= [controller disposableDocument].size() ? documents.front() : documents.back();
|
||||
[controller insertDocuments:documents atIndex:controller.selectedTabIndex + 1 selecting:documentToSelect andClosing:[controller disposableDocument]];
|
||||
return controller;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user