Skip to content

Commit

Permalink
im not sure
Browse files Browse the repository at this point in the history
  • Loading branch information
gnachman committed Mar 18, 2016
1 parent e33901d commit 9f79d49
Show file tree
Hide file tree
Showing 29 changed files with 574 additions and 445 deletions.
4 changes: 2 additions & 2 deletions iTerm2.xcodeproj/project.pbxproj
Expand Up @@ -2613,7 +2613,7 @@
A6B70FBF19830F0D007A4284 /* NewOutput.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = NewOutput.png; path = images/NewOutput.png; sourceTree = "<group>"; };
A6B70FC019830F0D007A4284 /* NewOutput@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "NewOutput@2x.png"; path = "images/NewOutput@2x.png"; sourceTree = "<group>"; };
A6B70FCB1986FB39007A4284 /* PTYSession+Scripting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PTYSession+Scripting.h"; sourceTree = "<group>"; };
A6B70FCC1986FB39007A4284 /* PTYSession+Scripting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PTYSession+Scripting.m"; sourceTree = "<group>"; };
A6B70FCC1986FB39007A4284 /* PTYSession+Scripting.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = "PTYSession+Scripting.m"; sourceTree = "<group>"; };
A6BDB03F1B45E8BA00F511E6 /* VT100XtermParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VT100XtermParserTest.m; sourceTree = "<group>"; };
A6BDB0401B45E8BA00F511E6 /* iTermEquivalenceClassSetTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iTermEquivalenceClassSetTest.m; sourceTree = "<group>"; };
A6BDB0431B45E8EE00F511E6 /* VT100ScreenTest.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = VT100ScreenTest.m; sourceTree = "<group>"; };
Expand All @@ -2636,7 +2636,7 @@
A6C760501B45C4CF00E3C992 /* libiTerm2Shared.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libiTerm2Shared.a; sourceTree = BUILT_PRODUCTS_DIR; };
A6C7641C1B45CB2800E3C992 /* iTerm2XCTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iTerm2XCTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
A6C7641F1B45CB2800E3C992 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A6C7DE4E199F302C001E5C75 /* PTYWindow+Scripting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PTYWindow+Scripting.m"; sourceTree = "<group>"; };
A6C7DE4E199F302C001E5C75 /* PTYWindow+Scripting.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = "PTYWindow+Scripting.m"; sourceTree = "<group>"; };
A6C7DE51199F3087001E5C75 /* PTYWindow+Scripting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PTYWindow+Scripting.h"; sourceTree = "<group>"; };
A6C7DE5319A4591E001E5C75 /* iTermNewWindowCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTermNewWindowCommand.h; sourceTree = "<group>"; };
A6C7DE5419A4591E001E5C75 /* iTermNewWindowCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iTermNewWindowCommand.m; sourceTree = "<group>"; };
Expand Down
4 changes: 0 additions & 4 deletions iTerm2XCTests/PTYTextViewTest.m
Expand Up @@ -359,10 +359,6 @@ - (void)selectPaneAboveInCurrentTerminal {
- (void)saveToDvr {
}

- (BOOL)textViewInSameTabAsTextView:(PTYTextView *)other {
return YES;
}

- (void)removeInaccessibleNotes {
}

Expand Down
2 changes: 1 addition & 1 deletion iTerm2XCTests/iTermToolbeltTest.m
Expand Up @@ -50,7 +50,7 @@ - (void)setUp {

// Create a window and save convenience pointers to its various bits.
_session = [[iTermController sharedInstance] launchBookmark:nil inTerminal:nil];
_windowController = (PseudoTerminal *)_session.tab.realParentWindow;
_windowController = (PseudoTerminal *)_session.delegate.realParentWindow;
_view = (iTermRootTerminalView *)_windowController.window.contentView;

// Make it big so all the tools fit.
Expand Down
6 changes: 3 additions & 3 deletions sources/AlertTrigger.m
Expand Up @@ -50,10 +50,10 @@ - (BOOL)performActionWithCapturedStrings:(NSString *const *)capturedStrings
break;

case NSAlertAlternateReturn: {
NSWindowController<iTermWindowController> * term = [[aSession tab] realParentWindow];
NSWindowController<iTermWindowController> * term = [[aSession delegate] realParentWindow];
[[term window] makeKeyAndOrderFront:nil];
[[term tabView] selectTabViewItemWithIdentifier:[aSession tab]];
[[aSession tab] setActiveSession:aSession];
[aSession.delegate sessionSelectContainingTab];
[aSession.delegate setActiveSession:aSession];
break;

case NSAlertOtherReturn:
Expand Down
6 changes: 3 additions & 3 deletions sources/CaptureTrigger.m
Expand Up @@ -43,15 +43,15 @@ - (NSString *)paramPlaceholder {
}

- (BOOL)capturedOutputToolVisibleInSession:(PTYSession *)aSession {
if (!aSession.tab.realParentWindow.shouldShowToolbelt) {
if (!aSession.delegate.realParentWindow.shouldShowToolbelt) {
return NO;
}
return [iTermToolbeltView shouldShowTool:kCapturedOutputToolName];
}

- (void)showCaptureOutputToolInSession:(PTYSession *)aSession {
if (!aSession.tab.realParentWindow.shouldShowToolbelt) {
[aSession.tab.realParentWindow toggleToolbeltVisibility:nil];
if (!aSession.delegate.realParentWindow.shouldShowToolbelt) {
[aSession.delegate.realParentWindow toggleToolbeltVisibility:nil];
}
if (![iTermToolbeltView shouldShowTool:kCapturedOutputToolName]) {
[iTermToolbeltView toggleShouldShowTool:kCapturedOutputToolName];
Expand Down
2 changes: 1 addition & 1 deletion sources/FakeWindow.m
Expand Up @@ -102,7 +102,7 @@ - (void)rejoin:(NSWindowController<iTermWindowController> *)aTerm
[aTerm sessionInitiatedResize:session width:pendingW height:pendingH];
}
if (hasPendingFitWindowToTab) {
[aTerm fitWindowToTab:[session tab]];
[aTerm fitWindowToTab:[aTerm tabForSession:session]];
}
if (hasPendingSetWindowTitle) {
[aTerm setWindowTitle];
Expand Down
2 changes: 1 addition & 1 deletion sources/GlobalSearch.m
Expand Up @@ -552,7 +552,7 @@ - (void)controlTextDidChange:(NSNotification *)aNotification
GlobalSearchInstance* aSearch;
aSearch = [[[GlobalSearchInstance alloc] initWithSession:aSession
findString:findString
label:[iTermExpose labelForTab:[aSession tab]
label:[iTermExpose labelForTab:[aTerminal tabForSession:aSession]
windowNumber:i+1
tabNumber:j+1]] autorelease];
[searches_ addObject:aSearch];
Expand Down
2 changes: 1 addition & 1 deletion sources/GrowlTrigger.m
Expand Up @@ -38,7 +38,7 @@ - (BOOL)performActionWithCapturedStrings:(NSString *const *)capturedStrings
[gd growlNotify:[self paramWithBackreferencesReplacedWithValues:capturedStrings count:captureCount]
withDescription:[NSString stringWithFormat:@"A trigger fired in session \"%@\" in tab #%d.",
[aSession name],
[[aSession tab] realObjectCount]]
aSession.delegate.tabNumber]
andNotification:@"Customized Message"
windowIndex:[aSession screenWindowIndex]
tabIndex:[aSession screenTabIndex]
Expand Down
37 changes: 19 additions & 18 deletions sources/MovePaneController.m
Expand Up @@ -74,7 +74,7 @@ - (void)exitMovePaneMode
}

- (void)moveWindowBy:(NSPoint)point {
NSWindow *window = session_.tab.realParentWindow.window;
NSWindow *window = session_.delegate.realParentWindow.window;
NSPoint origin = window.frame.origin;
origin.x += point.x;
origin.y += point.y;
Expand All @@ -83,14 +83,13 @@ - (void)moveWindowBy:(NSPoint)point {
[window setFrameOrigin:origin];
}

- (void)moveSessionToNewWindow:(PTYSession *)movingSession atPoint:(NSPoint)point
{
- (void)moveSessionToNewWindow:(PTYSession *)movingSession atPoint:(NSPoint)point {
if ([movingSession isTmuxClient]) {
[[movingSession tmuxController] breakOutWindowPane:[movingSession tmuxPane]
toPoint:point];
return;
}
PTYTab *theTab = [movingSession tab];
PTYTab *theTab = [movingSession.delegate.realParentWindow tabForSession:movingSession];
NSWindowController<iTermWindowController> * term =
[[theTab realParentWindow] terminalDraggedFromAnotherWindowAtPoint:point];

Expand All @@ -117,8 +116,8 @@ - (SessionView *)removeAndClearSession
SessionView *oldView = [session_ view];
[oldView retain];
PTYSession *movingSession = session_;
PTYTab *theTab = [movingSession tab];
[[movingSession tab] removeSession:movingSession];
PTYTab *theTab = [movingSession.delegate.realParentWindow tabForSession:movingSession];
[movingSession.delegate removeSession:movingSession];
if ([[theTab sessions] count] == 0) {
[[theTab realParentWindow] closeTab:theTab];
}
Expand Down Expand Up @@ -184,30 +183,32 @@ - (BOOL)dropInSession:(PTYSession *)dest
return YES;
}

PTYTab *destinationTab = [dest.delegate.realParentWindow tabForSession:dest];
if (isMove_) {
PTYSession *movingSession = session_;
BOOL isVertical = (half == kWestHalf || half == kEastHalf);
if (![[[dest tab] realParentWindow] canSplitPaneVertically:isVertical
withBookmark:[movingSession profile]]) {
if (![[destinationTab realParentWindow] canSplitPaneVertically:isVertical
withBookmark:[movingSession profile]]) {
return NO;
}

SessionView *oldView = [movingSession view];
[oldView retain];
PTYTab *theTab = [movingSession tab];
[[movingSession tab] removeSession:movingSession];
PTYTab *theTab = [movingSession.delegate.realParentWindow tabForSession:movingSession];
[theTab removeSession:movingSession];
if ([[theTab sessions] count] == 0) {
[[theTab realParentWindow] closeTab:theTab];
}
[[[dest tab] realParentWindow] splitVertically:isVertical
before:(half == kNorthHalf || half == kWestHalf)
addingSession:movingSession
targetSession:dest
performSetup:NO];

[[destinationTab realParentWindow] splitVertically:isVertical
before:(half == kNorthHalf || half == kWestHalf)
addingSession:movingSession
targetSession:dest
performSetup:NO];
[oldView release];
[[dest tab] fitSessionToCurrentViewSize:movingSession];
[destinationTab fitSessionToCurrentViewSize:movingSession];
} else {
[[dest tab] swapSession:dest withSession:session_];
[destinationTab swapSession:dest withSession:session_];
}
return YES;
}
Expand All @@ -228,7 +229,7 @@ - (void)beginDrag:(PTYSession *)session {
[pboard declareTypes:@[ iTermMovePaneDragType ] owner: nil];
[pboard setString:@"" forType:iTermMovePaneDragType];

PTYTab *theTab = [session tab];
PTYTab *theTab = [session.delegate.realParentWindow tabForSession:session];
NSRect rect = [[[session view] superview] convertRect:[[session view] frame] toView:nil];
SessionView *source = [session view];
[source retain];
Expand Down
12 changes: 6 additions & 6 deletions sources/PTYFontInfo.m
Expand Up @@ -32,10 +32,10 @@ - (void)dealloc {
}

- (PTYFontInfo *)computedBoldVersion {
NSFontManager* fontManager = [NSFontManager sharedFontManager];
NSFont* boldFont = [fontManager convertWeight:YES ofFont:font_];
if (boldFont && ([fontManager traitsOfFont:boldFont] & NSBoldFontMask)) {
DLog(@"Bold version of %@ is %@", font_, boldFont);
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSFont *boldFont = [fontManager convertWeight:YES ofFont:font_];
DLog(@"Bold version of %@ is %@", font_, boldFont);
if (boldFont && boldFont != font_) {
return [PTYFontInfo fontInfoWithFont:boldFont baseline:baselineOffset_];
} else {
DLog(@"Failed to find a bold version of %@", font_);
Expand All @@ -46,8 +46,8 @@ - (PTYFontInfo *)computedBoldVersion {
- (PTYFontInfo *)computedItalicVersion {
NSFontManager* fontManager = [NSFontManager sharedFontManager];
NSFont* italicFont = [fontManager convertFont:font_ toHaveTrait:NSItalicFontMask];
if (italicFont && ([fontManager traitsOfFont:italicFont] & NSItalicFontMask)) {
DLog(@"Italic version of %@ is %@", font_, italicFont);
DLog(@"Italic version of %@ is %@", font_, italicFont);
if (italicFont && italicFont != font_) {
return [PTYFontInfo fontInfoWithFont:italicFont baseline:baselineOffset_];
} else {
DLog(@"Failed to find an italic version of %@", font_);
Expand Down
38 changes: 19 additions & 19 deletions sources/PTYSession+Scripting.m
Expand Up @@ -7,16 +7,16 @@ @implementation PTYSession (Scripting)

// Object specifier
- (NSScriptObjectSpecifier *)objectSpecifier {
if (![[self tab] realParentWindow]) {
if (![self.delegate realParentWindow]) {
// TODO(georgen): scripting is broken while in instant replay.
return nil;
}
id classDescription = [NSClassDescription classDescriptionForClass:[PTYTab class]];

return [[[NSUniqueIDSpecifier alloc] initWithContainerClassDescription:classDescription
containerSpecifier:[self.tab objectSpecifier]
key:@"sessions"
uniqueID:self.guid] autorelease];
return [[[NSUniqueIDSpecifier alloc] initWithContainerClassDescription:classDescription
containerSpecifier:[self.delegate objectSpecifier]
key:@"sessions"
uniqueID:self.guid] autorelease];
}

// Handlers for supported commands:
Expand All @@ -39,7 +39,7 @@ - (void)handleExecScriptCommand:(NSScriptCommand *)aCommand {
}

- (void)handleSelectCommand:(NSScriptCommand *)command {
[[self tab] setActiveSession:self];
[self.delegate setActiveSession:self];
}

- (void)handleClearScriptCommand:(NSScriptCommand *)command {
Expand Down Expand Up @@ -135,9 +135,9 @@ - (id)handleSetVariableNamedCommand:(NSScriptCommand *)command {
}

- (PTYSession *)activateSessionAndTab {
PTYSession *saved = [self.tab.realParentWindow currentSession];
[[self.tab.realParentWindow tabView] selectTabViewItemWithIdentifier:self.tab];
[self.tab setActiveSession:self];
PTYSession *saved = [self.delegate.realParentWindow currentSession];
[self.delegate sessionSelectContainingTab];
[self.delegate setActiveSession:self];
return saved;
}

Expand All @@ -152,8 +152,8 @@ - (PTYSession *)splitVertically:(BOOL)vertically
temp[KEY_COMMAND_LINE] = command;
profile = temp;
}
PTYSession *session = [[[self tab] realParentWindow] splitVertically:vertically
withProfile:profile];
PTYSession *session = [[self.delegate realParentWindow] splitVertically:vertically
withProfile:profile];
[formerSession activateSessionAndTab];
return session;
}
Expand Down Expand Up @@ -237,11 +237,11 @@ - (id)handleSplitHorizontallyWithSameProfile:(NSScriptCommand *)scriptCommand {
}

- (void)handleTerminateScriptCommand:(NSScriptCommand *)command {
[[self tab] closeSession:self];
[self.delegate closeSession:self];
}

- (void)handleCloseCommand:(NSScriptCommand *)scriptCommand {
[self.tab.realParentWindow closeSessionWithConfirmation:self];
[self.delegate.realParentWindow closeSessionWithConfirmation:self];
}

- (NSColor *)backgroundColor {
Expand Down Expand Up @@ -445,15 +445,15 @@ - (void)setAnsiBrightWhiteColor:(NSColor*)color {
}

- (void)setColumns:(int)columns {
[[[self tab] realParentWindow] sessionInitiatedResize:self
width:columns
height:self.rows];
[[self.delegate realParentWindow] sessionInitiatedResize:self
width:columns
height:self.rows];
}

- (void)setRows:(int)rows {
[[[self tab] realParentWindow] sessionInitiatedResize:self
width:self.columns
height:rows];
[[self.delegate realParentWindow] sessionInitiatedResize:self
width:self.columns
height:rows];
}

- (NSString *)profileName {
Expand Down

0 comments on commit 9f79d49

Please sign in to comment.