Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions Classes/Controllers/PBGitSidebarController.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,31 @@ - (void)openSubmoduleFromMenuItem:(NSMenuItem *)menuItem

- (void)openSubmoduleAtURL:(NSURL *)submoduleURL
{
[[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:submoduleURL
display:YES
completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {
if (error) {
[self.windowController showErrorSheet:error];
}
}];
NSWindow *currentWindow = [[NSApplication sharedApplication] keyWindow];
NSEvent *theEvent = [[NSApplication sharedApplication] currentEvent];
BOOL openInTab = (theEvent && [theEvent modifierFlags] & NSEventModifierFlagOption)!=0;
[[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:submoduleURL
display:YES
completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {

if (error) {
[self.windowController showErrorSheet:error];
}
else if (!documentWasAlreadyOpen) {
if (@available(macOS 10.13, *)) {
if (openInTab) {
// move into a tab of the original window
if (currentWindow) {
NSWindow *myWindow = [[document.windowControllers firstObject] window];
if (myWindow) {
NSWindowTabGroup *tabGroup = currentWindow.tabGroup;
[tabGroup addWindow:myWindow];
}
}
}
}
}
}];
}

#pragma mark NSOutlineView delegate methods
Expand Down