Skip to content
Snippets Groups Projects
Commit b40106e0 authored by Brian K. White's avatar Brian K. White
Browse files

Merge pull request #10 from gnachman/master

Sync from upstream
parents cf36dab4 1f5856f3
No related branches found
No related tags found
No related merge requests found
Showing
with 152 additions and 118 deletions
Loading
Loading
@@ -75,7 +75,7 @@
 
- (void)twiddleKeyWindow
{
iTermApplicationDelegate *theDelegate = (iTermApplicationDelegate *)[NSApp delegate];
iTermApplicationDelegate *theDelegate = iTermApplication.sharedApplication.delegate;
[theDelegate makeHotKeyWindowKeyIfOpen];
[super close];
[parentWindow_ makeKeyAndOrderFront:self];
Loading
Loading
Loading
Loading
@@ -94,7 +94,4 @@ void LoadPrefsFromCustomFolder(void);
 
- (BOOL)importColorPresetFromFile:(NSString*)filename;
 
// Safely remove a profile and references to it and update display.
- (void)removeProfileWithGuid:(NSString *)guid;
@end
Loading
Loading
@@ -399,10 +399,5 @@ NSString *const kSessionProfileDidChange = @"kSessionProfileDidChange";
[[self window] setFrame:rect display:YES animate:YES];
}
 
- (void)removeProfileWithGuid:(NSString *)guid {
[_profilesViewController removeProfileWithGuid:guid
fromModel:[ProfileModel sharedInstance]];
}
@end
 
Loading
Loading
@@ -49,6 +49,4 @@ extern NSString *const kProfileSessionNameDidEndEditing;
- (void)resizeWindowForCurrentTab;
- (void)windowWillClose:(NSNotification *)notification;
 
- (void)removeProfileWithGuid:(NSString *)guid fromModel:(ProfileModel *)model;
@end
Loading
Loading
@@ -112,6 +112,10 @@ NSString *const kProfileSessionNameDidEndEditing = @"kProfileSessionNameDidEndEd
selector:@selector(sessionProfileDidChange:)
name:kSessionProfileDidChange
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(profileWasDeleted:)
name:kProfileWasDeletedNotification
object:nil];
}
return self;
}
Loading
Loading
@@ -343,27 +347,6 @@ NSString *const kProfileSessionNameDidEndEditing = @"kProfileSessionNameDidEndEd
_advancedViewController ];
}
 
- (void)removeKeyMappingsReferringToGuid:(NSString*)badRef {
for (NSString* guid in [[ProfileModel sharedInstance] guids]) {
Profile* profile = [[ProfileModel sharedInstance] bookmarkWithGuid:guid];
profile = [iTermKeyBindingMgr removeMappingsReferencingGuid:badRef fromBookmark:profile];
if (profile) {
[[ProfileModel sharedInstance] setBookmark:profile withGuid:guid];
}
}
for (NSString* guid in [[ProfileModel sessionsInstance] guids]) {
Profile* profile = [[ProfileModel sessionsInstance] bookmarkWithGuid:guid];
profile = [iTermKeyBindingMgr removeMappingsReferencingGuid:badRef fromBookmark:profile];
if (profile) {
[[ProfileModel sessionsInstance] setBookmark:profile withGuid:guid];
}
}
[iTermKeyBindingMgr removeMappingsReferencingGuid:badRef fromBookmark:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kKeyBindingsChangedNotification
object:nil
userInfo:nil];
}
- (void)updateSubviewsForProfile:(Profile *)profile {
ProfileModel *model = [_delegate profilePreferencesModel];
if ([model numberOfBookmarks] < 2 || !profile) {
Loading
Loading
@@ -433,37 +416,29 @@ NSString *const kProfileSessionNameDidEndEditing = @"kProfileSessionNameDidEndEd
- (IBAction)removeProfile:(id)sender {
DLog(@"removeProfile called");
Profile *profile = [self selectedProfile];
if ([[_delegate profilePreferencesModel] numberOfBookmarks] == 1 || !profile) {
ProfileModel *model = [_delegate profilePreferencesModel];
if (![ITAddressBookMgr canRemoveProfile:profile fromModel:model]) {
NSBeep();
} else if ([self confirmProfileDeletion:profile]) {
NSString *guid = profile[KEY_GUID];
DLog(@"Remove profile with guid %@ named %@", guid, profile[KEY_NAME]);
[self removeProfileWithGuid:guid fromModel:[_delegate profilePreferencesModel]];
int lastIndex = [_profilesListView selectedRow];
[ITAddressBookMgr removeProfile:profile fromModel:model];
// profileWasDeleted: gets called by notification from within removeProfile:fromModel:.
int toSelect = lastIndex - 1;
if (toSelect < 0) {
toSelect = 0;
}
[_profilesListView selectRowIndex:toSelect];
}
[[_delegate profilePreferencesModel] flush];
}
 
- (void)removeProfileWithGuid:(NSString *)guid fromModel:(ProfileModel *)model {
DLog(@"Remove profile with guid %@...", guid);
if ([model numberOfBookmarks] == 1) {
DLog(@"Refusing to remove only profile");
return;
}
int lastIndex = [_profilesListView selectedRow];
[self removeKeyMappingsReferringToGuid:guid];
DLog(@"Removing profile from model");
[[_delegate profilePreferencesModel] removeProfileWithGuid:guid];
// Ensure all profile list views reload their data to avoid issue 4033.
[[NSNotificationCenter defaultCenter] postNotificationName:kProfileWasDeletedNotification object:nil];
int toSelect = lastIndex - 1;
if (toSelect < 0) {
toSelect = 0;
- (void)profileWasDeleted:(NSNotification *)notification {
DLog(@"A profile was deleted.");
if ([_profilesListView selectedRow] == -1) {
[_profilesListView selectRowIndex:0];
}
[_profilesListView selectRowIndex:toSelect];
// If a profile was deleted, update the shortcut titles that might refer to it.
[_generalViewController updateShortcutTitles];
}
Loading
Loading
Loading
Loading
@@ -19,6 +19,7 @@
IBOutlet NSButton *_scrollbackInAlternateScreen;
IBOutlet NSPopUpButton *_characterEncoding;
IBOutlet NSComboBox *_terminalType;
IBOutlet NSTextField *_answerBackString;
IBOutlet NSButton *_xtermMouseReporting;
IBOutlet NSButton *_allowTitleReporting;
IBOutlet NSButton *_allowTitleSetting;
Loading
Loading
@@ -87,6 +88,10 @@
[self defineControl:_terminalType
key:KEY_TERMINAL_TYPE
type:kPreferenceInfoTypeStringTextField];
[self defineControl:_answerBackString
key:KEY_ANSWERBACK_STRING
type:kPreferenceInfoTypeStringTextField];
[self defineControl:_xtermMouseReporting
key:KEY_XTERM_MOUSE_REPORTING
Loading
Loading
Loading
Loading
@@ -1288,7 +1288,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
 
- (IBAction)closeCurrentSession:(id)sender
{
iTermApplicationDelegate *appDelegate = (iTermApplicationDelegate *)[[NSApplication sharedApplication] delegate];
iTermApplicationDelegate *appDelegate = iTermApplication.sharedApplication.delegate;
[appDelegate userDidInteractWithASession];
if ([[self window] isKeyWindow]) {
PTYSession *aSession = [[[_contentView.tabView selectedTabViewItem] identifier] activeSession];
Loading
Loading
@@ -1919,6 +1919,10 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
[aSession setTmuxController:tmuxController];
[self setDimmingForSession:aSession];
}
// Set the tab title from the active session's name, which (because it has
// a tmux controller) will be based on the tmux window's name provided by
// the tab. This must be done after setting the tmux controller.
[tab loadTitleFromSession];
[self endTmuxOriginatedResize];
}
 
Loading
Loading
@@ -2123,7 +2127,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
- (BOOL)windowShouldClose:(NSNotification *)aNotification
{
// This counts as an interaction beacuse it is only called when the user initiates the closing of the window (as opposed to a session dying on you).
iTermApplicationDelegate *appDelegate = (iTermApplicationDelegate *)[[NSApplication sharedApplication] delegate];
iTermApplicationDelegate *appDelegate = iTermApplication.sharedApplication.delegate;
[appDelegate userDidInteractWithASession];
 
BOOL needPrompt = NO;
Loading
Loading
@@ -2302,7 +2306,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
[[[NSApplication sharedApplication] dockTile] setShowsApplicationBadge:NO];
 
[[iTermController sharedInstance] setCurrentTerminal:self];
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
[itad updateMaximizePaneMenuItem];
[itad updateUseTransparencyMenuItem];
[itad updateBroadcastMenuState];
Loading
Loading
@@ -2982,7 +2986,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
return timeSinceLastResize < kTimeToPreserveTemporaryTitle;
}
- (void)updateUseTransparency {
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
[itad updateUseTransparencyMenuItem];
for (PTYSession* aSession in [self allSessions]) {
[[aSession view] setNeedsDisplay:YES];
Loading
Loading
@@ -3773,7 +3777,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
[aSession setFocused:(s == activeSession)];
}
[self showOrHideInstantReplayBar];
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
[itad updateBroadcastMenuState];
[self refreshTools];
[self updateTabColors];
Loading
Loading
@@ -3819,7 +3823,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
- (void)tabView:(NSTabView *)tabView willRemoveTabViewItem:(NSTabViewItem *)tabViewItem
{
[self saveAffinitiesLater:[tabViewItem identifier]];
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
[itad updateBroadcastMenuState];
}
 
Loading
Loading
@@ -3828,7 +3832,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
 
[self tabView:tabView willInsertTabViewItem:tabViewItem atIndex:[tabView numberOfTabViewItems]];
[self saveAffinitiesLater:[tabViewItem identifier]];
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
[itad updateBroadcastMenuState];
}
 
Loading
Loading
@@ -3844,7 +3848,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
[[theTab tmuxController] setClientSize:[theTab tmuxSize]];
}
[self saveAffinitiesLater:[tabViewItem identifier]];
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
[itad updateBroadcastMenuState];
}
 
Loading
Loading
@@ -4255,7 +4259,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
}
 
- (void)tabViewDoubleClickTabBar:(NSTabView *)tabView {
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
// Note: this assume that self is the front window (it should be!). It is smart enough to create
// a tmux tab if the user wants one (or ask if needed).
[itad newSession:nil];
Loading
Loading
@@ -5530,7 +5534,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
}
broadcastMode_ = mode;
[self setDimmingForSessions];
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
[itad updateBroadcastMenuState];
}
 
Loading
Loading
@@ -5591,7 +5595,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
}
// Update dimming of panes.
[self refreshTerminal:nil];
iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
[itad updateBroadcastMenuState];
}
 
Loading
Loading
@@ -6222,7 +6226,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
}
PtyLog(@"safelySetSessionSize");
BOOL hasScrollbar = [self scrollbarShouldBeVisible];
if (windowType_ == WINDOW_TYPE_NORMAL || windowType_ == WINDOW_TYPE_NO_TITLE_BAR) {
if (![self anyFullScreen]) {
int width = columns;
int height = rows;
if (width < 20) {
Loading
Loading
@@ -6640,6 +6644,7 @@ static NSString* TERMINAL_ARRANGEMENT_HIDING_TOOLBELT_SHOULD_RESIZE_WINDOW = @"H
withURL:nil
isHotkey:NO
makeKey:YES
canActivate:YES
command:nil
block:^PTYSession *(PseudoTerminal *term) {
// Keep session size stable.
Loading
Loading
Loading
Loading
@@ -49,9 +49,6 @@ static BOOL AdvanceAndEatControlChars(iTermParserContext *context,
while (iTermParserTryPeek(context, &c)) {
switch (c) {
case VT100CC_ENQ:
// TODO: This should respond with a user-definable "answerback" string, which
// defaults to the empty string.
break;
case VT100CC_BEL:
case VT100CC_BS:
case VT100CC_HT:
Loading
Loading
Loading
Loading
@@ -19,6 +19,7 @@
 
@property(nonatomic, assign) id<VT100TerminalDelegate> delegate;
@property(nonatomic, copy) NSString *termType;
@property(nonatomic, copy) NSString *answerBackString;
// The current encoding. May be changed by ISO2022_* code.
@property(nonatomic, assign) NSStringEncoding encoding;
// The "canonical" encoding, which is changed by user preference and never
Loading
Loading
Loading
Loading
@@ -31,6 +31,7 @@ NSString *const kSavedCursorOriginKey = @"Origin";
NSString *const kSavedCursorWraparoundKey = @"Wraparound";
 
NSString *const kTerminalStateTermTypeKey = @"Term Type";
NSString *const kTerminalStateAnswerBackStringKey = @"Answerback String";
NSString *const kTerminalStateStringEncodingKey = @"String Encoding";
NSString *const kTerminalStateCanonicalEncodingKey = @"Canonical String Encoding";
NSString *const kTerminalStateReportFocusKey = @"Report Focus";
Loading
Loading
@@ -226,6 +227,7 @@ static const int kMaxScreenRows = 4096;
[_output release];
[_parser release];
[_termType release];
[_answerBackString release];
 
[super dealloc];
}
Loading
Loading
@@ -269,6 +271,11 @@ static const int kMaxScreenRows = 4096;
[delegate_ terminalTypeDidChange];
}
 
- (void)setAnswerBackString:(NSString *)s {
s = [s stringByExpandingVimSpecialCharacters];
_answerBackString = [s copy];
}
- (void)setForeground24BitColor:(NSColor *)color {
graphicRendition_.fgColorCode = color.redComponent * 255.0;
graphicRendition_.fgGreen = color.greenComponent * 255.0;
Loading
Loading
@@ -1234,7 +1241,7 @@ static const int kMaxScreenRows = 4096;
 
// VT100 CC
case VT100CC_ENQ:
// TODO: Add support for an answerback string here.
[delegate_ terminalSendReport:[_answerBackString dataUsingEncoding:self.encoding]];
break;
case VT100CC_BEL:
[delegate_ terminalRingBell];
Loading
Loading
@@ -2373,6 +2380,7 @@ static const int kMaxScreenRows = 4096;
- (NSDictionary *)stateDictionary {
NSDictionary *dict =
@{ kTerminalStateTermTypeKey: self.termType ?: [NSNull null],
kTerminalStateAnswerBackStringKey: self.answerBackString ?: [NSNull null],
kTerminalStateStringEncodingKey: @(self.encoding),
kTerminalStateCanonicalEncodingKey: @(self.canonicalEncoding),
kTerminalStateReportFocusKey: @(self.reportFocus),
Loading
Loading
@@ -2408,6 +2416,12 @@ static const int kMaxScreenRows = 4096;
return;
}
self.termType = dict[kTerminalStateTermTypeKey];
self.answerBackString = dict[kTerminalStateAnswerBackStringKey];
if ([self.answerBackString isKindOfClass:[NSNull class]]) {
self.answerBackString = nil;
}
self.encoding = [dict[kTerminalStateStringEncodingKey] unsignedIntegerValue];
self.canonicalEncoding = [dict[kTerminalStateCanonicalEncodingKey] unsignedIntegerValue];
self.reportFocus = [dict[kTerminalStateReportFocusKey] boolValue];
Loading
Loading
Loading
Loading
@@ -33,7 +33,4 @@
 
#define NSLogRect(aRect) NSLog(@"Rect = %f,%f,%f,%f", (aRect).origin.x, (aRect).origin.y, (aRect).size.width, (aRect).size.height)
 
BOOL IsYosemiteOrLater(void);
BOOL IsMavericksOrLater(void);
#endif // _ITERM_H_
Loading
Loading
@@ -123,4 +123,6 @@
+ (BOOL)typingClearsSelection;
+ (BOOL)focusReportingEnabled;
 
+ (BOOL)hideFromDockAndAppSwitcher;
@end
Loading
Loading
@@ -99,6 +99,7 @@ DEFINE_FLOAT(idleTimeSeconds, 2, @"General: Time in seconds before a session is
DEFINE_FLOAT(findDelaySeconds, 1, @"General: Time to wait before performing Find action on 1- or 2- character queries.");
DEFINE_INT(maximumBytesToProvideToServices, 100000, @"General: Maximum number of bytes of selection to provide to Services.\nA large value here can cause performance issues when you have a big selection.");
DEFINE_BOOL(useOpenDirectory, YES, @"General: Use Open Directory to determine the user shell");
DEFINE_BOOL(hideFromDockAndAppSwitcher, NO, @"General: Hide iTerm2 from the dock and from the ⌘-Tab app switcher. This also hides the menu bar.\nYou must restart iTerm2 after changing this setting for it to take effect.");
 
#pragma mark - Semantic History
DEFINE_BOOL(ignoreHardNewlinesInURLs, NO, @"Semantic History: Ignore hard newlines for the purposes of locating URLs for Semantic History.\nIf a hard newline occurs at the end of a line then cmd-click will not see it all unless this setting is turned on. This is useful for some interactive applications.");
Loading
Loading
Loading
Loading
@@ -34,6 +34,8 @@
 
@interface iTermApplication : NSApplication
 
+ (iTermApplication *)sharedApplication;
// Sets the return value for -currentEvent. Only for testing.
@property(atomic, retain) NSEvent *fakeCurrentEvent;
 
Loading
Loading
Loading
Loading
@@ -47,6 +47,12 @@
[super dealloc];
}
 
+ (iTermApplication *)sharedApplication {
__kindof NSApplication *sharedApplication = [super sharedApplication];
assert([sharedApplication isKindOfClass:[iTermApplication class]]);
return sharedApplication;
}
- (BOOL)_eventUsesNavigationKeys:(NSEvent*)event {
NSString* unmodkeystr = [event charactersIgnoringModifiers];
if ([unmodkeystr length] == 0) {
Loading
Loading
Loading
Loading
@@ -28,6 +28,7 @@
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import "DebugLogging.h"
#import "iTermApplication.h"
 
@class PTYSession;
@class PseudoTerminal;
Loading
Loading
Loading
Loading
@@ -161,6 +161,12 @@ static BOOL hasBecomeActive = NO;
TurnOnDebugLoggingSilently();
}
 
if ([iTermAdvancedSettingsModel hideFromDockAndAppSwitcher]) {
ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
}
// set the TERM_PROGRAM environment variable
putenv("TERM_PROGRAM=iTerm.app");
 
Loading
Loading
@@ -825,6 +831,7 @@ static BOOL hasBecomeActive = NO;
withURL:urlStr
isHotkey:NO
makeKey:NO
canActivate:NO
command:nil
block:nil];
}
Loading
Loading
// -*- mode:objc -*-
// $Id: iTermController.h,v 1.29 2008-10-08 05:54:50 yfabian Exp $
/*
** iTermController.h
**
Loading
Loading
@@ -57,6 +55,10 @@
@property(nonatomic, readonly) int numberOfTerminals;
@property(nonatomic, readonly) BOOL hasRestorableSession;
 
BOOL IsYosemiteOrLater(void);
BOOL IsMavericksOrLater(void);
BOOL SystemVersionIsGreaterOrEqualTo(unsigned major, unsigned minor, unsigned bugfix);
+ (iTermController*)sharedInstance;
+ (void)sharedInstanceRelease;
+ (BOOL)getSystemVersionMajor:(unsigned *)major
Loading
Loading
@@ -105,6 +107,7 @@
withURL:(NSString *)url
isHotkey:(BOOL)isHotkey
makeKey:(BOOL)makeKey
canActivate:(BOOL)canActivate
command:(NSString *)command
block:(PTYSession *(^)(PseudoTerminal *))block;
- (PTYSession *)launchBookmark:(Profile *)profile inTerminal:(PseudoTerminal *)theTerm;
Loading
Loading
Loading
Loading
@@ -60,54 +60,53 @@
@end
 
// Constants for saved window arrangement key names.
static NSString* APPLICATION_SUPPORT_DIRECTORY = @"~/Library/Application Support";
static NSString *APPLICATION_SUPPORT_DIRECTORY = @"~/Library/Application Support";
static NSString *SUPPORT_DIRECTORY = @"~/Library/Application Support/iTerm";
static NSString *SCRIPT_DIRECTORY = @"~/Library/Application Support/iTerm/Scripts";
 
// Pref keys
static NSString *const kSelectionRespectsSoftBoundariesKey = @"Selection Respects Soft Boundaries";
 
static BOOL UncachedIsMavericksOrLater(void) {
unsigned major;
unsigned minor;
if ([iTermController getSystemVersionMajor:&major minor:&minor bugFix:nil]) {
return (major == 10 && minor >= 9) || (major > 10);
} else {
typedef struct {
unsigned int major;
unsigned int minor;
unsigned int bugfix;
} iTermSystemVersion;
iTermSystemVersion CachedSystemVersion(void) {
static iTermSystemVersion version;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[iTermController getSystemVersionMajor:&version.major
minor:&version.minor
bugFix:&version.bugfix];
});
return version;
}
BOOL SystemVersionIsGreaterOrEqualTo(unsigned major, unsigned minor, unsigned bugfix) {
iTermSystemVersion version = CachedSystemVersion();
if (version.major > major) {
return YES;
} else if (version.major < major) {
return NO;
}
}
BOOL IsMavericksOrLater(void) {
static BOOL result;
static BOOL initialized;
if (!initialized) {
initialized = YES;
result = UncachedIsMavericksOrLater();
if (version.minor > minor) {
return YES;
} else if (version.minor < minor) {
return NO;
}
return result;
return version.bugfix >= bugfix;
}
 
static BOOL UncachedIsYosemiteOrLater(void) {
unsigned major;
unsigned minor;
if ([iTermController getSystemVersionMajor:&major minor:&minor bugFix:nil]) {
return (major == 10 && minor >= 10) || (major > 10);
} else {
return NO;
}
BOOL IsMavericksOrLater(void) {
return SystemVersionIsGreaterOrEqualTo(10, 9, 0);
}
 
BOOL IsYosemiteOrLater(void) {
static BOOL result;
static BOOL initialized;
if (!initialized) {
initialized = YES;
result = UncachedIsYosemiteOrLater();
}
return result;
return SystemVersionIsGreaterOrEqualTo(10, 10, 0);
}
 
@implementation iTermController {
NSMutableArray *_restorableSessions;
NSMutableArray *_currentRestorableSessionsStack;
Loading
Loading
@@ -124,16 +123,15 @@ BOOL IsYosemiteOrLater(void) {
id runningApplicationClass_;
}
 
static iTermController* shared = nil;
static BOOL initDone = NO;
static iTermController* shared;
 
+ (iTermController*)sharedInstance
{
if (!shared && !initDone) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shared = [[iTermController alloc] init];
initDone = YES;
}
});
return shared;
}
 
Loading
Loading
@@ -192,8 +190,7 @@ static BOOL initDone = NO;
const BOOL sessionsWillRestore = ([iTermAdvancedSettingsModel runJobsInServers] &&
[iTermAdvancedSettingsModel restoreWindowContents] &&
self.willRestoreWindowsAtNextLaunch);
iTermApplicationDelegate *itad =
(iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate];
iTermApplicationDelegate *itad = iTermApplication.sharedApplication.delegate;
return (sessionsWillRestore &&
(itad.sparkleRestarting || ![iTermAdvancedSettingsModel killJobsInServersOnQuit]));
}
Loading
Loading
@@ -1087,6 +1084,7 @@ static BOOL initDone = NO;
withURL:nil
isHotkey:NO
makeKey:YES
canActivate:YES
command:nil
block:nil];
}
Loading
Loading
@@ -1153,6 +1151,7 @@ static BOOL initDone = NO;
withURL:(NSString *)url
isHotkey:(BOOL)isHotkey
makeKey:(BOOL)makeKey
canActivate:(BOOL)canActivate
command:(NSString *)command
block:(PTYSession *(^)(PseudoTerminal *))block {
PseudoTerminal *term;
Loading
Loading
@@ -1232,9 +1231,13 @@ static BOOL initDone = NO;
// When this function is activated from the dock icon's context menu make sure
// that the new window is on top of all other apps' windows. For some reason,
// makeKeyAndOrderFront does nothing.
[NSApp activateIgnoringOtherApps:YES];
if (canActivate) {
[NSApp activateIgnoringOtherApps:YES];
}
[[term window] makeKeyAndOrderFront:nil];
[NSApp arrangeInFront:self];
if (canActivate) {
[NSApp arrangeInFront:self];
}
}
 
return session;
Loading
Loading
//
// iTermDynamicProfileManager.h
// iTerm2
//
// Created by George Nachman on 12/30/15.
//
//
#import <Foundation/Foundation.h>
@interface iTermDynamicProfileManager : NSObject
+ (instancetype)sharedInstance;
// Load the profiles from |filename| and add valid profiles into |profiles|.
// Add their guids to |guids|.
- (BOOL)loadDynamicProfilesFromFile:(NSString *)filename
intoArray:(NSMutableArray *)profiles
guids:(NSMutableSet *)guids;
// Immediately examine the dynamic profiles files to see if they've changed and update the model
// if needed.
- (void)reloadDynamicProfiles;
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment