From 40c3913baf0b1e8963ffb7a646e0ce1f27faf752 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 3 Jan 2025 06:24:07 +0800 Subject: [PATCH] iTerm2: fix for powerpc --- aqua/iTerm2/Portfile | 114 +- ...1-Fixes-for-legacy-macOS-and-PowerPC.patch | 337 +++ aqua/iTerm2/files/patch-CVE-2019-9535.diff | 1840 ----------------- aqua/iTerm2/files/patch-Makefile-XC10.diff | 26 - aqua/iTerm2/files/patch-Makefile.diff | 13 - aqua/iTerm2/files/patch-nsur.diff | 24 - .../files/patch-remove-sparkle-3.4.diff | 210 -- aqua/iTerm2/files/patch-remove-sparkle.diff | 210 -- aqua/iTerm2/files/patch-xcode12.diff | 56 - 9 files changed, 369 insertions(+), 2461 deletions(-) create mode 100644 aqua/iTerm2/files/0001-Fixes-for-legacy-macOS-and-PowerPC.patch delete mode 100644 aqua/iTerm2/files/patch-CVE-2019-9535.diff delete mode 100644 aqua/iTerm2/files/patch-Makefile-XC10.diff delete mode 100644 aqua/iTerm2/files/patch-Makefile.diff delete mode 100644 aqua/iTerm2/files/patch-nsur.diff delete mode 100644 aqua/iTerm2/files/patch-remove-sparkle-3.4.diff delete mode 100644 aqua/iTerm2/files/patch-remove-sparkle.diff delete mode 100644 aqua/iTerm2/files/patch-xcode12.diff diff --git a/aqua/iTerm2/Portfile b/aqua/iTerm2/Portfile index b3fcbd359f6c6..196f3d0e21bf3 100644 --- a/aqua/iTerm2/Portfile +++ b/aqua/iTerm2/Portfile @@ -1,89 +1,39 @@ # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 -PortSystem 1.0 -PortGroup github 1.0 -PortGroup xcodeversion 1.0 - - -if {${os.major} > 17} { - version 3.4.21 - revision 0 - checksums rmd160 00cc53ced493db0be593d730f518f56ba0ebe5a3 \ - sha256 175b03c9ab41b7c3a5c62967c442fa306639effb5641554c5f6ae739198e0be3 \ - size 28781228 - patchfiles patch-Makefile-XC10.diff \ - patch-remove-sparkle-3.4.diff \ - patch-nsur.diff \ - patch-xcode12.diff -} elseif {${os.major} > 16} { - version 3.3.12 - revision 2 - checksums rmd160 37d4204f97ac42431c5774a943ca0ab8f9a4c669 \ - sha256 6eeeb3215d6725aa789d39108a8ebedbe1aa9f6d058dd33056d72471ecd02e14 \ - size 20602868 - patchfiles patch-Makefile-XC10.diff \ - patch-remove-sparkle.diff \ - patch-nsur.diff -} else { - version 3.2.0 - revision 1 - checksums rmd160 07915ff5db0545c0c059f47e7f71761e023a26e1 \ - sha256 017aff348352369abcc994caaca0f6112e1f17c4d65041acdb9f19830b2b96bd \ - size 11969144 - patchfiles patch-Makefile.diff \ - patch-nsur.diff -} - -github.setup gnachman iTerm2 ${version} v -categories aqua shells -platforms darwin -maintainers {mark @markemer} openmaintainer -license GPL-2+ -supported_archs x86_64 arm64 -use_xcode yes - -description Enhanced terminal emulator program, successor to iTerm -long_description \ - iTerm2 is a replacement for Terminal and the successor to iTerm. Its focus is on \ - performance, internationalization, and supporting innovative features \ - that make your life better. - -homepage https://iterm2.com/ - -livecheck.url https://raw.githubusercontent.com/gnachman/iterm2-website/master/source/appcasts/final_modern.xml -livecheck.regex {sparkle:version="([\d\.]+)"} +PortSystem 1.0 +PortGroup github 1.0 +PortGroup xcode 1.0 + +github.setup gnachman iTerm2 2.1.1 v +categories aqua shells +platforms {darwin > 8} +supported_archs i386 ppc x86_64 +maintainers nomaintainer +license GPL-2+ +description Enhanced terminal emulator program, successor to iTerm +long_description \ + iTerm2 is a replacement for Terminal and the successor to iTerm. \ + Its focus is on performance, internationalization, and supporting \ + innovative features that make your life better. +homepage https://iterm2.com +checksums rmd160 55f801ce37da52432e23bd9805564360aabd1b7b \ + sha256 a803b11e5068cc9f0863084e001b86660451d8242334a50b85d060d791dbee0f \ + size 2551385 +github.tarball_from archive + +patch.pre_args-replace -p0 -p1 +patchfiles 0001-Fixes-for-legacy-macOS-and-PowerPC.patch + +xcode.project iTerm.xcodeproj +xcode.target iTerm post-patch { - # patch the python script out since it does not set the correct version and may cause trouble - reinplace "s|exec tools/updateVersion.py|exec /usr/bin/true|g" ${worksrcpath}/iTerm2.xcodeproj/project.pbxproj - # macOS 13/Xcode 14 seems to be requiring code signing (macOS 12 with XC14 now requires the same) - if {${os.major} >= 21} { - reinplace "s|CODE_SIGN_IDENTITY = \".*\";|CODE_SIGN_IDENTITY = \"-\";|g" ${worksrcpath}/iTerm2.xcodeproj/project.pbxproj - } else { - reinplace "s|CODE_SIGN_IDENTITY = \".*\";|CODE_SIGN_IDENTITY = \"\";|g" ${worksrcpath}/iTerm2.xcodeproj/project.pbxproj - } - reinplace "s|enableUBSanitizer = \"YES\"||g" ${worksrcpath}/iTerm2.xcodeproj/xcshareddata/xcschemes/iTerm2.xcscheme - # Fix version number; see iTerm2/tools/updateVersion.py for version keys - foreach {key} {CFBundleGetInfoString CFBundleShortVersionString CFBundleVersion} { - system "/usr/libexec/PlistBuddy -c \"Set :${key} ${version}\" ${worksrcpath}/plists/iTerm2.plist" - } + reinplace "s|^version *= *.*$|version = \"${version}\"|" ${worksrcpath}/updateVersion.py + # disable Sparkle autoupdate + reinplace "s|.*Sparkle.*||g" ${worksrcpath}/${xcode.project}/project.pbxproj } -compiler.cpath -compiler.library_path - -use_configure no - -build.target prod - -destroot.destdir APPS=${destroot}${applications_dir} - -minimum_xcodeversions {16 9.0 17 10.0 18 11.0} - -if {${os.platform} eq "darwin" && ${os.major} < 16} { - known_fail yes - pre-fetch { - ui_error "${subport} @${version} requires macOS 10.12 or newer" - return -code error "unsupported OS X version" - } +destroot { + file copy ${build.dir}/build/Deployment/iTerm.app \ + ${destroot}${applications_dir}/${name}.app } diff --git a/aqua/iTerm2/files/0001-Fixes-for-legacy-macOS-and-PowerPC.patch b/aqua/iTerm2/files/0001-Fixes-for-legacy-macOS-and-PowerPC.patch new file mode 100644 index 0000000000000..e491ab87e9610 --- /dev/null +++ b/aqua/iTerm2/files/0001-Fixes-for-legacy-macOS-and-PowerPC.patch @@ -0,0 +1,337 @@ +From bf90066398369d8bd3ca43b0a67064b36d31ae97 Mon Sep 17 00:00:00 2001 +From: Sergey Fedorov +Date: Sat, 7 Dec 2024 12:43:39 +0800 +Subject: [PATCH] Fixes for legacy macOS and PowerPC + +--- + PTYTask.m | 2 +- + PseudoTerminal.m | 19 +++++++------- + iTerm.xcodeproj/project.pbxproj | 44 ++++++++++++++------------------- + iTermApplicationDelegate.m | 3 ++- + 4 files changed, 30 insertions(+), 38 deletions(-) + +diff --git a/PTYTask.m b/PTYTask.m +index 5d1d2fbd5..5806f8589 100644 +--- a/PTYTask.m ++++ b/PTYTask.m +@@ -1028,7 +1028,7 @@ static void reapchild(int n) + + pid_t ppid = taskAllInfo.pbsd.pbi_ppid; + if (ppid == parentPid) { +-#ifdef BLOCKS_NOT_AVAILABLE // OS 10.5 ++#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + long long birthday = taskAllInfo.pbsd.pbi_start.tv_sec * 1000000 + taskAllInfo.pbsd.pbi_start.tv_usec; + #else // OS 10.6+ + long long birthday = taskAllInfo.pbsd.pbi_start_tvsec * 1000000 + taskAllInfo.pbsd.pbi_start_tvusec; +diff --git a/PseudoTerminal.m b/PseudoTerminal.m +index c8a06fb22..1a4aef458 100644 +--- a/PseudoTerminal.m ++++ b/PseudoTerminal.m +@@ -78,7 +78,6 @@ + #import "ColorsMenuItemView.h" + #import "iTermFontPanel.h" + #import "FutureMethods.h" +-#import "iTermPromotionalMessageManager.h" + + #define CACHED_WINDOW_POSITIONS 100 + +@@ -4482,7 +4481,7 @@ NSString *sessionsKey = @"sessions"; + - (void)_refreshTerminal:(NSNotification *)aNotification + { + PtyLog(@"_refreshTerminal - calling fitWindowToTabs"); +- ++ + // If hiding of menu bar changed. + if ([self fullScreen] && ![self lionFullScreen]) { + if ([[self window] isKeyWindow]) { +@@ -4561,6 +4560,7 @@ NSString *sessionsKey = @"sessions"; + currentScreen = [NSScreen mainScreen]; + } + ++#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + // If screens have separate spaces (only applicable in Mavericks and later) then all screens have a menu bar. + if (currentScreen == menubarScreen || (IsMavericksOrLater() && [NSScreen futureScreensHaveSeparateSpaces])) { + int flags = NSApplicationPresentationAutoHideDock; +@@ -4570,21 +4570,26 @@ NSString *sessionsKey = @"sessions"; + iTermApplicationDelegate *itad = (iTermApplicationDelegate *)[[iTermApplication sharedApplication] delegate]; + [itad setFutureApplicationPresentationOptions:flags unset:0]; + } ++#endif + } + + - (void)showMenuBarHideDock + { ++#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + iTermApplicationDelegate *itad = [[iTermApplication sharedApplication] delegate]; + [itad setFutureApplicationPresentationOptions:NSApplicationPresentationAutoHideDock + unset:NSApplicationPresentationAutoHideMenuBar]; ++#endif + } + + - (void)showMenuBar + { ++#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + int flags = NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar; + iTermApplicationDelegate *itad = [[iTermApplication sharedApplication] delegate]; + [itad setFutureApplicationPresentationOptions:0 + unset:flags]; ++#endif + } + + // Grow or shrink the tabview to make room for the find bar in fullscreen mode +@@ -4768,13 +4773,6 @@ NSString *sessionsKey = @"sessions"; + [TABVIEW processMRUEvent:theEvent]; + + NSUInteger modifierFlags = [theEvent modifierFlags]; +- if (!(modifierFlags & (NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask | NSShiftKeyMask))) { +- // Schedule a promotional message when the user has interacted lightly with the app. If a +- // message is available to be shown, it'll pop up in a few seconds. This prevents headless +- // machines from getting interrupted by a promo. +- [[iTermPromotionalMessageManager sharedInstance] scheduleDisplayIfNeeded]; +- } +- + if (!(modifierFlags & NSCommandKeyMask) && + [[[self currentSession] TEXTVIEW] isFindingCursor]) { + // The cmd key was let up while finding the cursor +@@ -5960,12 +5958,13 @@ NSString *sessionsKey = @"sessions"; + [[self ptyWindow] setRestoreState:lastArrangement_]; + } + ++#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + - (NSApplicationPresentationOptions)window:(NSWindow *)window + willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions + { + return proposedOptions | NSApplicationPresentationAutoHideToolbar; + } +- ++#endif + + // accessors for to-many relationships: + // (See NSScriptKeyValueCoding.h) +diff --git a/iTerm.xcodeproj/project.pbxproj b/iTerm.xcodeproj/project.pbxproj +index 35729ef8b..0f0d8d636 100644 +--- a/iTerm.xcodeproj/project.pbxproj ++++ b/iTerm.xcodeproj/project.pbxproj +@@ -406,8 +406,6 @@ + 9DB3D6F1176CCABE0071CCF8 /* PrefsArrangements@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9DB3D6EF176CCABE0071CCF8 /* PrefsArrangements@2x.png */; }; + A073973E14C768E400786414 /* ColorsMenuItemView.h in Headers */ = {isa = PBXBuildFile; fileRef = A073973D14C768E400786414 /* ColorsMenuItemView.h */; }; + A073974014C7694600786414 /* ColorsMenuItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = A073973F14C7694600786414 /* ColorsMenuItemView.m */; }; +- A6624F351AFC5EEE0040BA66 /* iTermPromotionalMessageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A6624F331AFC5EEE0040BA66 /* iTermPromotionalMessageManager.h */; }; +- A6624F361AFC5EEE0040BA66 /* iTermPromotionalMessageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A6624F341AFC5EEE0040BA66 /* iTermPromotionalMessageManager.m */; }; + A6AA395C18275EB800A19BD5 /* SBSystemPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = A6AA395B18275EB800A19BD5 /* SBSystemPreferences.h */; }; + A6AA395E18275EF200A19BD5 /* ScriptingBridge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6AA395D18275EF200A19BD5 /* ScriptingBridge.framework */; }; + A6C537B9192DD54A00A08C18 /* OnlineHelp in Resources */ = {isa = PBXBuildFile; fileRef = A6C537B8192DD54A00A08C18 /* OnlineHelp */; }; +@@ -752,8 +750,6 @@ + 9DB3D6EF176CCABE0071CCF8 /* PrefsArrangements@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "PrefsArrangements@2x.png"; path = "images/PrefsArrangements@2x.png"; sourceTree = ""; }; + A073973D14C768E400786414 /* ColorsMenuItemView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorsMenuItemView.h; sourceTree = ""; }; + A073973F14C7694600786414 /* ColorsMenuItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ColorsMenuItemView.m; sourceTree = ""; }; +- A6624F331AFC5EEE0040BA66 /* iTermPromotionalMessageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTermPromotionalMessageManager.h; sourceTree = ""; }; +- A6624F341AFC5EEE0040BA66 /* iTermPromotionalMessageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iTermPromotionalMessageManager.m; sourceTree = ""; }; + A6AA395B18275EB800A19BD5 /* SBSystemPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBSystemPreferences.h; sourceTree = ""; }; + A6AA395D18275EF200A19BD5 /* ScriptingBridge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScriptingBridge.framework; path = System/Library/Frameworks/ScriptingBridge.framework; sourceTree = SDKROOT; }; + A6C537B8192DD54A00A08C18 /* OnlineHelp */ = {isa = PBXFileReference; lastKnownFileType = folder; path = OnlineHelp; sourceTree = ""; }; +@@ -981,8 +977,6 @@ + A073973F14C7694600786414 /* ColorsMenuItemView.m */, + 1D70BA331680158700824B72 /* PTYFontInfo.h */, + 1D70BA341680158700824B72 /* PTYFontInfo.m */, +- A6624F331AFC5EEE0040BA66 /* iTermPromotionalMessageManager.h */, +- A6624F341AFC5EEE0040BA66 /* iTermPromotionalMessageManager.m */, + ); + name = Classes; + sourceTree = ""; +@@ -1537,7 +1531,6 @@ + 1D5FDD5F1208E8F000C46BA3 /* PSMTabBarControl.h in Headers */, + 1D5FDD601208E8F000C46BA3 /* PSMTabStyle.h in Headers */, + 1D5FDD611208E8F000C46BA3 /* NSBezierPath_AMShading.h in Headers */, +- A6624F351AFC5EEE0040BA66 /* iTermPromotionalMessageManager.h in Headers */, + 1D5FDD621208E8F000C46BA3 /* PSMTabDragAssistant.h in Headers */, + 1D5FDD631208E8F000C46BA3 /* PSMUnifiedTabStyle.h in Headers */, + 1D5FDD641208E8F000C46BA3 /* PSMAdiumTabStyle.h in Headers */, +@@ -1981,7 +1974,6 @@ + 1D3D21911482F18A00FAC8E7 /* TmuxController.m in Sources */, + 1D3D21961483144600FAC8E7 /* TSVParser.m in Sources */, + 1D3D21B014839AAB00FAC8E7 /* TmuxLayoutParser.m in Sources */, +- A6624F361AFC5EEE0040BA66 /* iTermPromotionalMessageManager.m in Sources */, + 1DB67CEE14850D53005849A1 /* TmuxWindowOpener.m in Sources */, + 1DB67CF21485C578005849A1 /* TmuxHistoryParser.m in Sources */, + 1DB67CF61486BD3D005849A1 /* TmuxStateParser.m in Sources */, +@@ -2117,7 +2109,7 @@ + ); + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)"; + GCC_C_LANGUAGE_STANDARD = c99; +- GCC_VERSION = com.apple.compilers.llvmgcc42; ++ GCC_VERSION = 4.2; + GCC_WARN_PROTOTYPE_CONVERSION = NO; + GCC_WARN_SIGN_COMPARE = NO; + MACOSX_DEPLOYMENT_TARGET = 10.5; +@@ -2135,7 +2127,6 @@ + x86_64, + ppc, + ); +- CODE_SIGN_IDENTITY = "Don't Code Sign"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ( +@@ -2144,6 +2135,7 @@ + ); + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 3; ++ GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = 4.2; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; +@@ -2184,12 +2176,12 @@ + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)"; + GCC_C_LANGUAGE_STANDARD = c99; +- GCC_VERSION = com.apple.compilers.llvmgcc42; ++ GCC_VERSION = 4.2; + GCC_WARN_PROTOTYPE_CONVERSION = NO; + GCC_WARN_SIGN_COMPARE = NO; + MACOSX_DEPLOYMENT_TARGET = 10.5; + SDKROOT = macosx; +- VALID_ARCHS = "i386 x86_64"; ++ VALID_ARCHS = "ppc i386 x86_64"; + WARNING_CFLAGS = "-Wall"; + }; + name = Nightly; +@@ -2207,7 +2199,7 @@ + ); + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 3; +- GCC_VERSION = com.apple.compilers.llvmgcc42; ++ GCC_VERSION = 4.2; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_MISSING_PARENTHESES = YES; +@@ -2234,7 +2226,7 @@ + ); + PRODUCT_NAME = iTerm; + SDKROOT = macosx10.6; +- VALID_ARCHS = "i386 x86_64"; ++ VALID_ARCHS = "ppc i386 x86_64"; + WARNING_CFLAGS = "-Wall"; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; +@@ -2251,7 +2243,7 @@ + ); + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)"; + GCC_C_LANGUAGE_STANDARD = c99; +- GCC_VERSION = com.apple.compilers.llvmgcc42; ++ GCC_VERSION = 4.2; + GCC_WARN_PROTOTYPE_CONVERSION = NO; + GCC_WARN_SIGN_COMPARE = NO; + MACOSX_DEPLOYMENT_TARGET = 10.5; +@@ -2259,7 +2251,7 @@ + VALID_ARCHS = "i386 ppc x86_64"; + WARNING_CFLAGS = "-Wall"; + }; +- name = "Leopard Deployment"; ++ name = "LeopardDeployment"; + }; + 1D3BD8A31688FBC0006CCF37 /* Leopard Deployment */ = { + isa = XCBuildConfiguration; +@@ -2269,7 +2261,6 @@ + i386, + ppc, + ); +- CODE_SIGN_IDENTITY = "Don't Code Sign"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ( +@@ -2279,7 +2270,8 @@ + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 3; + "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = BLOCKS_NOT_AVAILABLE; +- GCC_VERSION = com.apple.compilers.llvmgcc42; ++ GCC_C_LANGUAGE_STANDARD = c99; ++ GCC_VERSION = 4.2; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_MISSING_PARENTHESES = YES; +@@ -2311,7 +2303,7 @@ + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; +- name = "Leopard Deployment"; ++ name = "LeopardDeployment"; + }; + BB024D36096EE4080021E793 /* Development */ = { + isa = XCBuildConfiguration; +@@ -2401,8 +2393,8 @@ + "-licucore", + ); + PRODUCT_NAME = iTerm; +- SDKROOT = macosx10.10; +- VALID_ARCHS = "i386 x86_64"; ++ SDKROOT = macosx10.6; ++ VALID_ARCHS = "ppc i386 x86_64"; + WARNING_CFLAGS = "-Wall"; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; +@@ -2425,7 +2417,7 @@ + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G4; + GCC_OPTIMIZATION_LEVEL = 3; +- GCC_VERSION = ""; ++ GCC_VERSION = 4.2; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; + GCC_WARN_MISSING_PARENTHESES = YES; +@@ -2466,7 +2458,7 @@ + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)"; + GCC_C_LANGUAGE_STANDARD = c99; +- GCC_VERSION = com.apple.compilers.llvmgcc42; ++ GCC_VERSION = 4.2; + GCC_WARN_CHECK_SWITCH_STATEMENTS = YES; + GCC_WARN_MISSING_PARENTHESES = YES; + GCC_WARN_PROTOTYPE_CONVERSION = NO; +@@ -2477,7 +2469,7 @@ + GENERATE_PROFILING_CODE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.5; + SDKROOT = macosx; +- VALID_ARCHS = x86_64; ++ VALID_ARCHS = "ppc i386 x86_64"; + WARNING_CFLAGS = "-Wall"; + }; + name = Development; +@@ -2492,7 +2484,7 @@ + ); + FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)"; + GCC_C_LANGUAGE_STANDARD = c99; +- GCC_VERSION = com.apple.compilers.llvmgcc42; ++ GCC_VERSION = 4.2; + GCC_WARN_PROTOTYPE_CONVERSION = NO; + GCC_WARN_SIGN_COMPARE = NO; + MACOSX_DEPLOYMENT_TARGET = 10.5; +@@ -2512,7 +2504,7 @@ + GCC_WARN_SIGN_COMPARE = NO; + MACOSX_DEPLOYMENT_TARGET = 10.5; + SDKROOT = macosx; +- VALID_ARCHS = x86_64; ++ VALID_ARCHS = "ppc i386 x86_64"; + WARNING_CFLAGS = "-Wall"; + }; + name = Default; +diff --git a/iTermApplicationDelegate.m b/iTermApplicationDelegate.m +index 2f7ca3438..71b6e47bb 100644 +--- a/iTermApplicationDelegate.m ++++ b/iTermApplicationDelegate.m +@@ -136,6 +136,7 @@ static BOOL hasBecomeActive = NO; + [setInv setSelector:@selector(setPresentationOptions:)]; + [setInv setArgument:&presentationOptions atIndex:2]; + [setInv invoke]; ++#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 + } else { + // Emulate setPresentationOptions API for OS 10.5. + if (flags & NSApplicationPresentationAutoHideMenuBar) { +@@ -143,7 +144,7 @@ static BOOL hasBecomeActive = NO; + } else if (antiflags & NSApplicationPresentationAutoHideMenuBar) { + SetSystemUIMode(kUIModeNormal, 0); + } +- ++#endif + } + } + diff --git a/aqua/iTerm2/files/patch-CVE-2019-9535.diff b/aqua/iTerm2/files/patch-CVE-2019-9535.diff deleted file mode 100644 index 0fd7e45590a5e..0000000000000 --- a/aqua/iTerm2/files/patch-CVE-2019-9535.diff +++ /dev/null @@ -1,1840 +0,0 @@ -From 538d570ea54614d3a2b5724f820953d717fbeb0c Mon Sep 17 00:00:00 2001 -From: George Nachman -Date: Wed, 25 Sep 2019 23:13:00 -0700 -Subject: [PATCH] Do not send server-controlled values in tmux integration - mode. - -CVE-2019-9535 - -- Use session number everywhere rather than session name -- Do not poll tmux for the set-titles-string, status-left, and status-right and - then request the values of the returned format strings. Use ${T:} eval - instead. These features are now only available for tmux 2.9 and later. -- Hex-encode options saved in the tmux server to make them unexploitable (e.g., - hotkeys, window affinities, window origins, etc.). The old values are - accepted as inputs but will never be produced as output. ---- - iTerm2.xcodeproj/project.pbxproj | 8 + - sources/PTYSession.m | 28 ++- - sources/PTYTab.m | 13 +- - sources/PseudoTerminal.m | 9 +- - sources/TmuxController.h | 47 ++-- - sources/TmuxController.m | 305 +++++++++++++++----------- - sources/TmuxDashboardController.m | 163 +++++++------- - sources/TmuxSessionsTable.h | 30 +-- - sources/TmuxSessionsTable.m | 106 ++++----- - sources/TmuxWindowsTable.h | 2 +- - sources/TmuxWindowsTable.m | 21 +- - sources/iTermInitialDirectory+Tmux.h | 2 +- - sources/iTermInitialDirectory+Tmux.m | 20 +- - sources/iTermTmuxOptionMonitor.h | 4 + - sources/iTermTmuxOptionMonitor.m | 16 +- - sources/iTermTmuxSessionObject.h | 17 ++ - sources/iTermTmuxSessionObject.m | 12 + - sources/iTermTmuxStatusBarMonitor.h | 1 + - sources/iTermTmuxStatusBarMonitor.m | 28 +-- - sources/iTermWorkingDirectoryPoller.m | 1 + - 20 files changed, 471 insertions(+), 362 deletions(-) - create mode 100644 sources/iTermTmuxSessionObject.h - create mode 100644 sources/iTermTmuxSessionObject.m - -diff --git iTerm2.xcodeproj/project.pbxproj iTerm2.xcodeproj/project.pbxproj -index 7e2f86a..32e1df2 100644 ---- iTerm2.xcodeproj/project.pbxproj -+++ iTerm2.xcodeproj/project.pbxproj -@@ -1376,6 +1376,8 @@ - 53E184F21FE32F2800DB78F3 /* iTermMetalBufferPool.m in Sources */ = {isa = PBXBuildFile; fileRef = 53E184F01FE32F2800DB78F3 /* iTermMetalBufferPool.m */; }; - 53E8F36F2244A58800F3770F /* iTermActionsModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E8F36D2244A58800F3770F /* iTermActionsModel.h */; }; - 53E8F3702244A58800F3770F /* iTermActionsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 53E8F36E2244A58800F3770F /* iTermActionsModel.m */; }; -+ 53E98E7B233C6B760094D8A9 /* iTermTmuxSessionObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 53E98E79233C6B760094D8A9 /* iTermTmuxSessionObject.h */; }; -+ 53E98E7C233C6B760094D8A9 /* iTermTmuxSessionObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 53E98E7A233C6B760094D8A9 /* iTermTmuxSessionObject.m */; }; - 53E9DFE0220D518E0070C9C0 /* AlertTrigger.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D9DCC15142D7FC10016228A /* AlertTrigger.m */; }; - 53E9DFE1220D51D50070C9C0 /* CoprocessTrigger.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D9DDD91142E5AC600275650 /* CoprocessTrigger.m */; }; - 53E9DFE2220D52730070C9C0 /* PasswordTrigger.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DABA03219253FEA00A228D8 /* PasswordTrigger.m */; }; -@@ -4429,6 +4431,8 @@ - 53E184F01FE32F2800DB78F3 /* iTermMetalBufferPool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iTermMetalBufferPool.m; sourceTree = ""; }; - 53E8F36D2244A58800F3770F /* iTermActionsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iTermActionsModel.h; sourceTree = ""; }; - 53E8F36E2244A58800F3770F /* iTermActionsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iTermActionsModel.m; sourceTree = ""; }; -+ 53E98E79233C6B760094D8A9 /* iTermTmuxSessionObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iTermTmuxSessionObject.h; sourceTree = ""; }; -+ 53E98E7A233C6B760094D8A9 /* iTermTmuxSessionObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iTermTmuxSessionObject.m; sourceTree = ""; }; - 53EBF29B1DCBFF7C00766613 /* iTermAPIServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTermAPIServer.h; sourceTree = ""; }; - 53EBF29C1DCBFF7C00766613 /* iTermAPIServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = iTermAPIServer.m; sourceTree = ""; }; - 53EBF29F1DCCF4AC00766613 /* iTermIPV4Address.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iTermIPV4Address.h; sourceTree = ""; }; -@@ -7010,6 +7014,8 @@ - A6F718B4226438FC0053488E /* iTermInitialDirectory+Tmux.m */, - 53D68F7E2283EE7C0018710D /* iTermTmuxLayoutBuilder.h */, - 53D68F7F2283EE7C0018710D /* iTermTmuxLayoutBuilder.m */, -+ 53E98E79233C6B760094D8A9 /* iTermTmuxSessionObject.h */, -+ 53E98E7A233C6B760094D8A9 /* iTermTmuxSessionObject.m */, - ); - name = tmux; - sourceTree = ""; -@@ -9987,6 +9993,7 @@ - A6153D4C21F30A9C002976FC /* iTermJobTreeViewController.h in Headers */, - 5370678F21C9D2780088D0F3 /* SIGSHA2VerificationAlgorithm.h in Headers */, - A66719161DCE36C3000CE608 /* NSURL+iTerm.h in Headers */, -+ 53E98E7B233C6B760094D8A9 /* iTermTmuxSessionObject.h in Headers */, - A66719171DCE36C3000CE608 /* NSDate+iTerm.h in Headers */, - A6BCAAD821F6F53E0000CD29 /* iTermTextPopoverViewController.h in Headers */, - A66719181DCE36C3000CE608 /* iTermBaseHotKey.h in Headers */, -@@ -12429,6 +12436,7 @@ - A6AC5D241E9036D70097C0A7 /* iTermURLMark.m in Sources */, - 535EA51420D8C1EB00FC81E0 /* iTermProfilesWindowController.m in Sources */, - A6A4866F20B67A1600493302 /* iTermSemanticHistoryPrefsController.m in Sources */, -+ 53E98E7C233C6B760094D8A9 /* iTermTmuxSessionObject.m in Sources */, - A66719621DCE3772000CE608 /* iTermSocketAddress.m in Sources */, - A6A4867E20B67FD100493302 /* SmartSelectionController.m in Sources */, - 53AFFC8E1DD2A04100E6CEC6 /* iTermLSOF.m in Sources */, -diff --git sources/PTYSession.m sources/PTYSession.m -index 9b64e03..0332d8c 100644 ---- sources/PTYSession.m -+++ sources/PTYSession.m -@@ -4726,7 +4726,7 @@ ITERM_WEAKLY_REFERENCEABLE - } else { - // Legacy code path for pre tmux 2.6 - [_tmuxController renameWindowWithId:_delegate.tmuxWindow -- inSession:nil -+ inSessionNumber:nil - toName:profile[KEY_NAME]]; - } - _tmuxTitleOutOfSync = NO; -@@ -5910,14 +5910,18 @@ scrollToFirstResult:(BOOL)scrollToFirstResult { - - - (void)installTmuxStatusBarMonitor { - assert(!_tmuxStatusBarMonitor); -- _tmuxStatusBarMonitor = [[iTermTmuxStatusBarMonitor alloc] initWithGateway:_tmuxController.gateway -- scope:self.variablesScope]; -- _tmuxStatusBarMonitor.active = [iTermProfilePreferences boolForKey:KEY_SHOW_STATUS_BAR inProfile:self.profile]; -- if ([iTermPreferences boolForKey:kPreferenceKeyUseTmuxStatusBar] || -- [iTermStatusBarLayout shouldOverrideLayout:self.profile[KEY_STATUS_BAR_LAYOUT]]) { -- [self setSessionSpecificProfileValues:@{ KEY_STATUS_BAR_LAYOUT: [[iTermStatusBarLayout tmuxLayoutWithController:_tmuxController -- scope:nil -- window:self.delegate.tmuxWindow] dictionaryValue] }]; -+ -+ if (_tmuxController.gateway.minimumServerVersion.doubleValue >= 2.9) { -+ // Just use the built-in status bar for older versions of tmux because they don't support ${T:xxx} or ${E:xxx} -+ _tmuxStatusBarMonitor = [[iTermTmuxStatusBarMonitor alloc] initWithGateway:_tmuxController.gateway -+ scope:self.variablesScope]; -+ _tmuxStatusBarMonitor.active = [iTermProfilePreferences boolForKey:KEY_SHOW_STATUS_BAR inProfile:self.profile]; -+ if ([iTermPreferences boolForKey:kPreferenceKeyUseTmuxStatusBar] || -+ [iTermStatusBarLayout shouldOverrideLayout:self.profile[KEY_STATUS_BAR_LAYOUT]]) { -+ [self setSessionSpecificProfileValues:@{ KEY_STATUS_BAR_LAYOUT: [[iTermStatusBarLayout tmuxLayoutWithController:_tmuxController -+ scope:nil -+ window:self.delegate.tmuxWindow] dictionaryValue] }]; -+ } - } - } - -@@ -5929,7 +5933,8 @@ scrollToFirstResult:(BOOL)scrollToFirstResult { - } - __weak __typeof(self) weakSelf = self; - _tmuxTitleMonitor = [[iTermTmuxOptionMonitor alloc] initWithGateway:_tmuxController.gateway -- scope:self.variablesScope -+ scope:self.variablesScope -+ fallbackVariableName:nil - format:@"#{pane_title}" - target:[NSString stringWithFormat:@"%%%@", @(self.tmuxPane)] - variableName:iTermVariableKeySessionTmuxPaneTitle -@@ -6308,8 +6313,7 @@ scrollToFirstResult:(BOOL)scrollToFirstResult { - [_tmuxController ping]; - [_tmuxController validateOptions]; - [_tmuxController checkForUTF8]; -- [_tmuxController guessVersion]; -- [_tmuxController loadTitleFormat]; -+ [_tmuxController guessVersion]; // NOTE: This kicks off more stuff that depends on knowing the version number. - } - - - (void)tmuxInitialCommandDidFailWithError:(NSString *)error { -diff --git sources/PTYTab.m sources/PTYTab.m -index a8f8b48..6c4766e 100644 ---- sources/PTYTab.m -+++ sources/PTYTab.m -@@ -3690,11 +3690,12 @@ static void SetAgainstGrainDim(BOOL isVertical, NSSize *dest, CGFloat value) { - return; - } - _tmuxTitleMonitor = [[iTermTmuxOptionMonitor alloc] initWithGateway:tmuxController_.gateway -- scope:self.variablesScope -- format:tmuxController_.setTitlesString -- target:[NSString stringWithFormat:@"@%@", @(self.tmuxWindow)] -- variableName:iTermVariableKeyTabTmuxWindowTitle -- block:nil]; -+ scope:self.variablesScope -+ fallbackVariableName:iTermVariableKeySessionWindowName -+ format:@"#{T:set-titles-string}" -+ target:[NSString stringWithFormat:@"@%@", @(self.tmuxWindow)] -+ variableName:iTermVariableKeyTabTmuxWindowTitle -+ block:nil]; - [_tmuxTitleMonitor updateOnce]; - if (self.titleOverride.length == 0) { - // Show the tmux window title if both the tmux option set-titles is on and the user hasn't -@@ -4312,7 +4313,7 @@ static void SetAgainstGrainDim(BOOL isVertical, NSSize *dest, CGFloat value) { - if (self.tmuxTab) { - if (titleOverride) { - [self.tmuxController renameWindowWithId:self.tmuxWindow -- inSession:nil -+ inSessionNumber:nil - toName:titleOverride]; - } - return; -diff --git sources/PseudoTerminal.m sources/PseudoTerminal.m -index b90e733..24f041a 100644 ---- sources/PseudoTerminal.m -+++ sources/PseudoTerminal.m -@@ -3018,8 +3018,8 @@ ITERM_WEAKLY_REFERENCEABLE - if ([arrangement objectForKey:TERMINAL_GUID] && - [[arrangement objectForKey:TERMINAL_GUID] isKindOfClass:[NSString class]]) { - NSString *savedGUID = [arrangement objectForKey:TERMINAL_GUID]; -- if ([[iTermController sharedInstance] terminalWithGuid:savedGUID]) { -- // Refuse to create a window with an already-used guid. -+ if ([[iTermController sharedInstance] terminalWithGuid:savedGUID] || ![self stringIsValidTerminalGuid:savedGUID]) { -+ // Refuse to create a window with an already-used or invalid guid. - self.terminalGuid = [NSString stringWithFormat:@"pty-%@", [NSString uuid]]; - } else { - self.terminalGuid = savedGUID; -@@ -3039,6 +3039,11 @@ ITERM_WEAKLY_REFERENCEABLE - return YES; - } - -+- (BOOL)stringIsValidTerminalGuid:(NSString *)string { -+ NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"]; -+ return [string rangeOfCharacterFromSet:characterSet.invertedSet].location == NSNotFound; -+} -+ - - (BOOL)restoreTabsFromArrangement:(NSDictionary *)arrangement sessions:(NSArray *)sessions { - for (NSDictionary *tabArrangement in arrangement[TERMINAL_ARRANGEMENT_TABS]) { - NSDictionary *sessionMap = nil; -diff --git sources/TmuxController.h sources/TmuxController.h -index f27bacc..f1e5ad3 100644 ---- sources/TmuxController.h -+++ sources/TmuxController.h -@@ -8,6 +8,7 @@ - #import - #import "ProfileModel.h" - #import "iTermInitialDirectory.h" -+#import "iTermTmuxSessionObject.h" - #import "TmuxGateway.h" - #import "WindowControllerInterface.h" - -@@ -33,7 +34,7 @@ extern NSString *const kTmuxControllerWindowDidClose; - extern NSString *const kTmuxControllerAttachedSessionDidChange; - // Posted when a session changes name - extern NSString *const kTmuxControllerSessionWasRenamed; --// Posted when set-titles-string option changes. Object is tmux controller. -+// Posted when set-titles option changes. Object is tmux controller. - extern NSString *const kTmuxControllerDidFetchSetTitlesStringOption; - - @interface TmuxController : NSObject -@@ -41,7 +42,7 @@ extern NSString *const kTmuxControllerDidFetchSetTitlesStringOption; - @property(nonatomic, readonly) TmuxGateway *gateway; - @property(nonatomic, retain) NSMutableDictionary *windowPositions; - @property(nonatomic, copy) NSString *sessionName; --@property(nonatomic, retain) NSArray *sessions; -+@property(nonatomic, copy) NSArray *sessionObjects; - @property(nonatomic, assign) BOOL ambiguousIsDoubleWidth; - @property(nonatomic, assign) NSInteger unicodeVersion; - @property(nonatomic, readonly) NSString *clientName; -@@ -53,7 +54,6 @@ extern NSString *const kTmuxControllerDidFetchSetTitlesStringOption; - @property(nonatomic, readonly) NSDictionary *sharedFontOverrides; - @property(nonatomic, readonly) NSString *sessionGuid; - @property(nonatomic, readonly) BOOL variableWindowSize; --@property(nonatomic, readonly) NSString *setTitlesString; - @property(nonatomic, readonly) BOOL shouldSetTitles; - @property(nonatomic, readonly) BOOL serverIsLocal; - -@@ -120,9 +120,9 @@ extern NSString *const kTmuxControllerDidFetchSetTitlesStringOption; - scope:(iTermVariableScope *)scope - initialDirectory:(iTermInitialDirectory *)initialDirectory; - --- (void)newWindowInSession:(NSString *)targetSession -- scope:(iTermVariableScope *)scope -- initialDirectory:(iTermInitialDirectory *)initialDirectory; -+- (void)newWindowInSessionNumber:(NSNumber *)sessionNumber -+ scope:(iTermVariableScope *)scope -+ initialDirectory:(iTermInitialDirectory *)initialDirectory; - - - (void)selectPane:(int)windowPane; - -@@ -150,9 +150,11 @@ extern NSString *const kTmuxControllerDidFetchSetTitlesStringOption; - - - (void)killWindowPane:(int)windowPane; - - (void)killWindow:(int)window; --- (void)unlinkWindowWithId:(int)windowId inSession:(NSString *)sessionName; -+- (void)unlinkWindowWithId:(int)windowId; - - (void)requestDetach; --- (void)renameWindowWithId:(int)windowId inSession:(NSString *)sessionName toName:(NSString *)newName; -+- (void)renameWindowWithId:(int)windowId -+ inSessionNumber:(NSNumber *)sessionNumber -+ toName:(NSString *)newName; - - (BOOL)canRenamePane; - - (void)renamePane:(int)windowPane toTitle:(NSString *)newTitle; - - (void)setHotkeyForWindowPane:(int)windowPane to:(NSDictionary *)hotkey; -@@ -162,21 +164,25 @@ extern NSString *const kTmuxControllerDidFetchSetTitlesStringOption; - - (NSString *)tabColorStringForWindowPane:(int)windowPane; - - - (void)linkWindowId:(int)windowId -- inSession:(NSString *)sessionName -- toSession:(NSString *)targetSession; -+ inSessionNumber:(int)sessionNumber -+ toSessionNumber:(int)targetSession; -+ - - (void)moveWindowId:(int)windowId -- inSession:(NSString *)sessionName -- toSession:(NSString *)targetSession; -+ inSessionNumber:(int)sessionNumber -+ toSessionNumber:(int)targetSessionNumber; -+ -+- (void)renameSessionNumber:(int)sessionNumber -+ to:(NSString *)newName; - --- (void)renameSession:(NSString *)oldName to:(NSString *)newName; --- (void)killSession:(NSString *)sessionName; --- (void)attachToSession:(NSString *)sessionName; -+- (void)killSessionNumber:(int)sessionNumber; -+- (void)attachToSessionWithNumber:(int)sessionNumber; - - (void)addSessionWithName:(NSString *)sessionName; --// NOTE: If the session name is bogus (or any other error occurs) the selector will not be called. --- (void)listWindowsInSession:(NSString *)sessionName -- target:(id)target -- selector:(SEL)selector -- object:(id)object; -+// NOTE: If anything goes wrong the selector will not be called. -+- (void)listWindowsInSessionNumber:(int)sessionNumber -+ target:(id)target -+ selector:(SEL)selector -+ object:(id)object; -+ - - (void)listSessions; - - (void)saveAffinities; - - (void)saveWindowOrigins; -@@ -200,7 +206,6 @@ extern NSString *const kTmuxControllerDidFetchSetTitlesStringOption; - - (void)setLayoutInWindow:(int)window toLayout:(NSString *)layout; - - (NSArray *)clientSessions; - --- (void)setSize:(NSSize)size windows:(NSArray *)windows; - - (void)setSize:(NSSize)size window:(int)window; - - @end -diff --git sources/TmuxController.m sources/TmuxController.m -index 08cbd91..77b0424 100644 ---- sources/TmuxController.m -+++ sources/TmuxController.m -@@ -20,6 +20,7 @@ - #import "iTermShortcut.h" - #import "iTermTuple.h" - #import "NSArray+iTerm.h" -+#import "NSData+iTerm.h" - #import "NSFont+iTerm.h" - #import "NSStringITerm.h" - #import "PreferencePanel.h" -@@ -42,6 +43,12 @@ NSString *const kTmuxControllerWindowDidClose = @"kTmuxControllerWindowDidClose" - NSString *const kTmuxControllerSessionWasRenamed = @"kTmuxControllerSessionWasRenamed"; - NSString *const kTmuxControllerDidFetchSetTitlesStringOption = @"kTmuxControllerDidFetchSetTitlesStringOption"; - -+static NSString *const iTermTmuxControllerEncodingPrefixHotkeys = @"h_"; -+static NSString *const iTermTmuxControllerEncodingPrefixTabColors = @"t_"; -+static NSString *const iTermTmuxControllerEncodingPrefixAffinities = @"a_"; -+static NSString *const iTermTmuxControllerEncodingPrefixOrigins = @"o_"; -+static NSString *const iTermTmuxControllerEncodingPrefixHidden = @"i_"; -+ - // Unsupported global options: - static NSString *const kAggressiveResize = @"aggressive-resize"; - -@@ -81,7 +88,7 @@ static NSString *kListWindowsFormat = @"\"#{session_name}\t#{window_id}\t" - TmuxGateway *gateway_; - NSMutableDictionary *windowPanes_; // paneId -> PTYSession * - NSMutableDictionary *_windowStates; // Key is window number -- NSArray *sessions_; -+ NSArray *sessionObjects_; - int numOutstandingWindowResizes_; - NSMutableDictionary *windowPositions_; - NSSize lastSize_; // last size for windowDidChange: -@@ -97,7 +104,7 @@ static NSString *kListWindowsFormat = @"\"#{session_name}\t#{window_id}\t" - BOOL windowOriginsDirty_; - BOOL haveOutstandingSaveWindowOrigins_; - NSMutableDictionary *origins_; // window id -> NSValue(Point) window origin -- NSMutableSet *hiddenWindows_; -+ NSMutableSet *hiddenWindows_; - NSTimer *listSessionsTimer_; // Used to do a cancelable delayed perform of listSessions. - NSTimer *listWindowsTimer_; // Used to do a cancelable delayed perform of listWindows. - BOOL ambiguousIsDoubleWidth_; -@@ -119,7 +126,7 @@ static NSString *kListWindowsFormat = @"\"#{session_name}\t#{window_id}\t" - @synthesize gateway = gateway_; - @synthesize windowPositions = windowPositions_; - @synthesize sessionName = sessionName_; --@synthesize sessions = sessions_; -+@synthesize sessionObjects = sessionObjects_; - @synthesize ambiguousIsDoubleWidth = ambiguousIsDoubleWidth_; - @synthesize sessionId = sessionId_; - -@@ -180,8 +187,7 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - [_sharedFontOverrides release]; - [_pendingWindows release]; - [sessionName_ release]; -- [sessions_ release]; -- [_setTitlesString release]; -+ [sessionObjects_ release]; - - [super dealloc]; - } -@@ -392,16 +398,22 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - } - [windowsToOpen addObject:record]; - } -+ BOOL tooMany = NO; - if (windowsToOpen.count > [iTermPreferences intForKey:kPreferenceKeyTmuxDashboardLimit]) { - DLog(@"There are too many windows to open so just show the dashboard"); - haveHidden = YES; -+ tooMany = YES; - [windowsToOpen removeAllObjects]; - } - if (haveHidden) { - DLog(@"Hidden windows existing, showing dashboard"); - [[TmuxDashboardController sharedInstance] showWindow:nil]; - [[[TmuxDashboardController sharedInstance] window] makeKeyAndOrderFront:nil]; -- [[iTermNotificationController sharedInstance] notify:@"Too many tmux windows!" withDescription:@"Use the tmux dashboard to select which to open."]; -+ if (tooMany) { -+ [[iTermNotificationController sharedInstance] notify:@"Too many tmux windows!" withDescription:@"Use the tmux dashboard to select which to open."]; -+ } else { -+ [[iTermNotificationController sharedInstance] notify:@"Some tmux windows were hidden." withDescription:@"Use the tmux dashboard to select which to open."]; -+ } - } - for (NSArray *record in windowsToOpen) { - DLog(@"Open window %@", record); -@@ -459,7 +471,7 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - NSString *setSizeCommand = [NSString stringWithFormat:@"refresh-client -C %d,%d", - size.width, [self adjustHeightForStatusBar:size.height]]; - NSString *listWindowsCommand = [NSString stringWithFormat:@"list-windows -F %@", kListWindowsFormat]; -- NSString *listSessionsCommand = @"list-sessions -F \"#{session_name}\""; -+ NSString *listSessionsCommand = @"list-sessions -F \"#{session_id} #{session_name}\""; - NSString *getAffinitiesCommand = [NSString stringWithFormat:@"show -v -q -t $%d @affinities", sessionId_]; - NSString *getOriginsCommand = [NSString stringWithFormat:@"show -v -q -t $%d @origins", sessionId_]; - NSString *getHotkeysCommand = [NSString stringWithFormat:@"show -v -q -t $%d @hotkeys", sessionId_]; -@@ -715,10 +727,6 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - } - } - --- (void)setSize:(NSSize)size windows:(NSArray *)windows { -- [gateway_ sendCommandList:[self commandListToSetSize:size ofWindows:windows]]; --} -- - - (void)setWindowSizes:(NSArray *> *)windowSizes { - [gateway_ sendCommandList:[self commandListToSetWindowSizes:windowSizes]]; - } -@@ -727,14 +735,14 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - return [windowSizes mapWithBlock:^NSDictionary *(iTermTuple *tuple) { - NSString *window = tuple.firstObject; - NSSize size = tuple.secondObject.sizeValue; -- if ([window hasPrefix:@"pty"]) { -+ if ([window hasPrefix:@"pty"] || [window hasSuffix:@"_ph"]) { - return nil; - } - // 10000 comes from WINDOW_MAXIMUM in tmux.h - if (size.width < 1 || size.height < 1 || size.width >= 10000 || size.height >= 10000) { - return nil; - } -- NSString *command = [NSString stringWithFormat:@"resize-window -x %@ -y %@ -t @%@", @((int)size.width), @((int)size.height), window]; -+ NSString *command = [NSString stringWithFormat:@"resize-window -x %@ -y %@ -t @%d", @((int)size.width), @((int)size.height), window.intValue]; - NSDictionary *dict = [gateway_ dictionaryForCommand:command - responseTarget:self - responseSelector:@selector(handleResizeWindowResponse:) -@@ -857,11 +865,6 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - [gateway_ sendCommandList:@[ [gateway_ dictionaryForCommand:@"show-options -v -g set-titles" - responseTarget:self - responseSelector:@selector(handleShowSetTitles:) -- responseObject:nil -- flags:0], -- [gateway_ dictionaryForCommand:@"show-options -v -g set-titles-string" -- responseTarget:self -- responseSelector:@selector(handleShowSetTitlesString:) - responseObject:nil - flags:0] ]]; - } -@@ -872,10 +875,6 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - object:self]; - } - --- (void)handleShowSetTitlesString:(NSString *)setTitlesString { -- _setTitlesString = [setTitlesString copy]; --} -- - - (void)guessVersion { - // Run commands that will fail in successively older versions. - // show-window-options pane-border-format will succeed in 2.3 and later (presumably. 2.3 isn't out yet) -@@ -1013,17 +1012,25 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - } - - // This is the oldest version supported. By the time you get here you know the version. -+ [self didGuessVersion]; -+} -+ -+// Actions to perform after the version number is known. -+- (void)didGuessVersion { - [self loadServerPID]; -+ [self loadTitleFormat]; - } - --- (BOOL)recyclingSupported { -- NSDecimalNumber *version1_9 = [NSDecimalNumber decimalNumberWithString:@"1.9"]; -- if (gateway_.minimumServerVersion != nil) { -- return ([gateway_.minimumServerVersion compare:version1_9] != NSOrderedAscending); -- } else { -- // Assume 1.8 -+- (BOOL)versionAtLeastDecimalNumberWithString:(NSString *)string { -+ NSDecimalNumber *version = [NSDecimalNumber decimalNumberWithString:string]; -+ if (gateway_.minimumServerVersion == nil) { - return NO; - } -+ return ([gateway_.minimumServerVersion compare:version] != NSOrderedAscending); -+} -+ -+- (BOOL)recyclingSupported { -+ return [self versionAtLeastDecimalNumberWithString:@"1.9"]; - } - - // Show an error and terminate the connection because tmux has an unsupported option turned on. -@@ -1143,10 +1150,10 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - responseSelector:nil]; - } - --- (void)newWindowInSession:(NSString *)targetSession -- scope:(iTermVariableScope *)scope -- initialDirectory:(iTermInitialDirectory *)initialDirectory { -- [initialDirectory tmuxNewWindowCommandInSession:targetSession -+- (void)newWindowInSessionNumber:(NSNumber *)sessionNumber -+ scope:(iTermVariableScope *)scope -+ initialDirectory:(iTermInitialDirectory *)initialDirectory { -+ [initialDirectory tmuxNewWindowCommandInSessionNumber:sessionNumber - recyclingSupported:self.recyclingSupported - scope:scope - completion: -@@ -1164,7 +1171,11 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - responseObject:nil - flags:0]]; - } -- [commands addObject:[gateway_ dictionaryForCommand:command responseTarget:nil responseSelector:nil responseObject:nil flags:0]]; -+ [commands addObject:[gateway_ dictionaryForCommand:command -+ responseTarget:nil -+ responseSelector:nil -+ responseObject:nil -+ flags:0]]; - [gateway_ sendCommandList:commands]; - }]; - } -@@ -1218,8 +1229,7 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - responseSelector:nil]; - } - --- (void)unlinkWindowWithId:(int)windowId inSession:(NSString *)sessionName --{ -+- (void)unlinkWindowWithId:(int)windowId { - [gateway_ sendCommand:[NSString stringWithFormat:@"unlink-window -k -t @%d", windowId] - responseTarget:nil - responseSelector:nil -@@ -1232,11 +1242,14 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - } - - - (void)renameWindowWithId:(int)windowId -- inSession:(NSString *)sessionName -+ inSessionNumber:(NSNumber *)sessionNumber - toName:(NSString *)newName { - NSString *theCommand; -- if (sessionName) { -- theCommand = [NSString stringWithFormat:@"rename-window -t \"%@:@%d\" \"%@\"", sessionName, windowId, [self stringByEscapingBackslashesAndRemovingNewlines:newName]]; -+ if (sessionNumber) { -+ theCommand = [NSString stringWithFormat:@"rename-window -t \"$%d:@%d\" \"%@\"", -+ sessionNumber.intValue, -+ windowId, -+ [self stringByEscapingBackslashesAndRemovingNewlines:newName]]; - } else { - theCommand = [NSString stringWithFormat:@"rename-window -t @%d \"%@\"", windowId, [self stringByEscapingBackslashesAndRemovingNewlines:newName]]; - } -@@ -1312,9 +1325,23 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - [self sendCommandToSetTabColors]; - } - -+- (NSString *)encodedString:(NSString *)string prefix:(NSString *)prefix { -+ return [prefix stringByAppendingString:[[string dataUsingEncoding:NSUTF8StringEncoding] it_hexEncoded]]; -+} -+ -+- (NSString *)decodedString:(NSString *)string optionalPrefix:(NSString *)prefix { -+ if (![string hasPrefix:prefix]) { -+ return string; -+ } -+ return [[[NSString alloc] initWithData:[[string substringFromIndex:prefix.length] dataFromHexValues] -+ encoding:NSUTF8StringEncoding] autorelease]; -+} -+ - - (void)sendCommandToSetHotkeys { -+ NSString *hexEncoded = [self encodedString:[self.hotkeysString stringByEscapingQuotes] -+ prefix:iTermTmuxControllerEncodingPrefixHotkeys]; - NSString *command = [NSString stringWithFormat:@"set -t $%d @hotkeys \"%@\"", -- sessionId_, [self.hotkeysString stringByEscapingQuotes]]; -+ sessionId_, hexEncoded]; - [gateway_ sendCommand:command - responseTarget:nil - responseSelector:nil -@@ -1323,8 +1350,10 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - } - - - (void)sendCommandToSetTabColors { -+ - NSString *command = [NSString stringWithFormat:@"set -t $%d @tab_colors \"%@\"", -- sessionId_, [self.tabColorsString stringByEscapingQuotes]]; -+ sessionId_, [self encodedString:[self.tabColorsString stringByEscapingQuotes] -+ prefix:iTermTmuxControllerEncodingPrefixTabColors]]; - [gateway_ sendCommand:command - responseTarget:nil - responseSelector:nil -@@ -1376,7 +1405,8 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - - - (void)breakOutWindowPane:(int)windowPane toTabAside:(NSString *)sibling - { -- [gateway_ sendCommand:[NSString stringWithFormat:@"break-pane -P -F \"#{window_id}\" %@ \"%%%d\"", [self breakPaneWindowPaneFlag], windowPane] -+ [gateway_ sendCommand:[NSString stringWithFormat:@"break-pane -P -F \"#{window_id}\" %@ \"%%%d\"", -+ [self breakPaneWindowPaneFlag], windowPane] - responseTarget:self - responseSelector:@selector(windowPaneBrokeOutWithWindowId:setAffinityTo:) - responseObject:sibling -@@ -1435,19 +1465,19 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - } - - - (void)linkWindowId:(int)windowId -- inSession:(NSString *)sessionName -- toSession:(NSString *)targetSession { -- [gateway_ sendCommand:[NSString stringWithFormat:@"link-window -s \"%@:@%d\" -t \"%@:+\"", -- sessionName, windowId, targetSession] -+ inSessionNumber:(int)sessionNumber -+ toSessionNumber:(int)targetSessionNumber { -+ [gateway_ sendCommand:[NSString stringWithFormat:@"link-window -s \"$%d:@%d\" -t \"$%d:+\"", -+ sessionNumber, windowId, targetSessionNumber] - responseTarget:nil - responseSelector:nil]; - } - - - (void)moveWindowId:(int)windowId -- inSession:(NSString *)sessionName -- toSession:(NSString *)targetSession { -- [gateway_ sendCommand:[NSString stringWithFormat:@"move-window -s \"%@:@%d\" -t \"%@:+\"", -- sessionName, windowId, targetSession] -+ inSessionNumber:(int)sessionNumber -+ toSessionNumber:(int)targetSessionNumber { -+ [gateway_ sendCommand:[NSString stringWithFormat:@"move-window -s \"$%d:@%d\" -t \"$%d:+\"", -+ sessionNumber, windowId, targetSessionNumber] - responseTarget:nil - responseSelector:nil]; - } -@@ -1467,19 +1497,19 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - return pos; - } - --- (void)renameSession:(NSString *)oldName to:(NSString *)newName --{ -- NSString *renameCommand = [NSString stringWithFormat:@"rename-session -t \"%@\" \"%@\"", -- [oldName stringByEscapingQuotes], -+- (void)renameSessionNumber:(int)sessionNumber -+ to:(NSString *)newName { -+ NSString *renameCommand = [NSString stringWithFormat:@"rename-session -t \"$%d\" \"%@\"", -+ sessionNumber, - [newName stringByEscapingQuotes]]; - [gateway_ sendCommand:renameCommand responseTarget:nil responseSelector:nil]; - } - --- (void)killSession:(NSString *)sessionName --{ -- NSString *killCommand = [NSString stringWithFormat:@"kill-session -t \"%@\"", -- [sessionName stringByEscapingQuotes]]; -- [gateway_ sendCommand:killCommand responseTarget:nil responseSelector:nil]; -+- (void)killSessionNumber:(int)sessionNumber { -+ NSString *killCommand = [NSString stringWithFormat:@"kill-session -t \"$%d\"", sessionNumber]; -+ [gateway_ sendCommand:killCommand -+ responseTarget:nil -+ responseSelector:nil]; - [self listSessions]; - } - -@@ -1493,44 +1523,46 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - [self listSessions]; - } - --- (void)attachToSession:(NSString *)sessionName --{ -- NSString *attachCommand = [NSString stringWithFormat:@"attach-session -t \"%@\"", -- [sessionName stringByEscapingQuotes]]; -+- (void)attachToSessionWithNumber:(int)sessionNumber { -+ NSString *attachCommand = [NSString stringWithFormat:@"attach-session -t \"$%d\"", sessionNumber]; - [gateway_ sendCommand:attachCommand - responseTarget:nil - responseSelector:nil]; - } - --- (void)listWindowsInSession:(NSString *)sessionName -- target:(id)target -- selector:(SEL)selector -- object:(id)object { -+- (void)listWindowsInSessionNumber:(int)sessionNumber -+ target:(id)target -+ selector:(SEL)selector -+ object:(id)object { - if (detached_ || !object) { - // This can happen if you're not attached to a session. - return; - } -- NSString *listWindowsCommand = [NSString stringWithFormat:@"list-windows -F %@ -t \"%@\"", -- kListWindowsFormat, sessionName]; -+ NSString *listWindowsCommand = [NSString stringWithFormat:@"list-windows -F %@ -t \"$%d\"", -+ kListWindowsFormat, sessionNumber]; - // Wait a few seconds. We always get a windows-close notification when the last window in - // a window closes. To avoid spamming the command line with list-windows, we wait a bit to see - // if there is an exit notification coming down the pipe. - const CGFloat kListWindowsDelay = 1.5; - [listWindowsTimer_ invalidate]; -- listWindowsTimer_ = [NSTimer scheduledTimerWithTimeInterval:kListWindowsDelay -- target:self -- selector:@selector(listWindowsTimerFired:) -- userInfo:[NSArray arrayWithObjects:listWindowsCommand, object, target, NSStringFromSelector(selector), nil] -- repeats:NO]; -+ listWindowsTimer_ = -+ [NSTimer scheduledTimerWithTimeInterval:kListWindowsDelay -+ target:self -+ selector:@selector(listWindowsTimerFired:) -+ userInfo:@[listWindowsCommand, -+ object, -+ target, -+ NSStringFromSelector(selector) ] -+ repeats:NO]; - } - - - (void)listWindowsTimerFired:(NSTimer *)timer - { - NSArray *array = [timer userInfo]; -- NSString *command = [array objectAtIndex:0]; -- id object = [array objectAtIndex:1]; -- id target = [array objectAtIndex:2]; -- NSString *selector = [array objectAtIndex:3]; -+ NSString *command = array[0]; -+ id object = array[1]; -+ id target = array[2]; -+ NSString *selector = array[3]; - - [listWindowsTimer_ invalidate]; - listWindowsTimer_ = nil; -@@ -1538,10 +1570,7 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - [gateway_ sendCommand:command - responseTarget:self - responseSelector:@selector(didListWindows:userData:) -- responseObject:[NSArray arrayWithObjects:object, -- selector, -- target, -- nil] -+ responseObject:@[object, selector, target] - flags:kTmuxGatewayCommandShouldTolerateErrors]; // Tolerates errors because the session may have been detached by the time we get the notification or the timer fires. - } - -@@ -1549,8 +1578,10 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - { - NSString *hidden = [[hiddenWindows_ allObjects] componentsJoinedByString:@","]; - NSString *command = [NSString stringWithFormat: -- @"set -t $%d @hidden \"%@\"", -- sessionId_, hidden]; -+ @"set -t $%d @hidden \"%@\"", -+ sessionId_, -+ [self encodedString:hidden -+ prefix:iTermTmuxControllerEncodingPrefixHidden]]; - [gateway_ sendCommand:command - responseTarget:nil - responseSelector:nil -@@ -1594,7 +1625,9 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - NSString *enc = [maps componentsJoinedByString:@" "]; - DLog(@"Save window origins to %@ called from %@", enc, [NSThread callStackSymbols]); - NSString *command = [NSString stringWithFormat:@"set -t $%d @origins \"%@\"", -- sessionId_, [enc stringByEscapingQuotes]]; -+ sessionId_, -+ [self encodedString:[enc stringByEscapingQuotes] -+ prefix:iTermTmuxControllerEncodingPrefixOrigins]]; - if (!lastOrigins_ || ![command isEqualToString:lastOrigins_]) { - [lastOrigins_ release]; - lastOrigins_ = [command copy]; -@@ -1603,7 +1636,8 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - responseTarget:self - responseSelector:@selector(saveWindowOriginsResponse:)]; - } -- [self getOriginsResponse:enc]; -+ [self getOriginsResponse:[self encodedString:[enc stringByEscapingQuotes] -+ prefix:iTermTmuxControllerEncodingPrefixOrigins]]; - } - - - (void)saveWindowOriginsResponse:(NSString *)response -@@ -1651,7 +1685,8 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - // Update affinities if any have changed. - NSString *arg = [affinities componentsJoinedByString:@" "]; - NSString *command = [NSString stringWithFormat:@"set -t $%d @affinities \"%@\"", -- sessionId_, [arg stringByEscapingQuotes]]; -+ sessionId_, [self encodedString:[arg stringByEscapingQuotes] -+ prefix:iTermTmuxControllerEncodingPrefixAffinities]]; - if ([command isEqualToString:lastSaveAffinityCommand_]) { - return; - } -@@ -1763,7 +1798,7 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - responseSelector:@selector(didSetLayout:) - responseObject:nil - flags:0], -- [gateway_ dictionaryForCommand:[NSString stringWithFormat:@"list-windows -F \"#{window_id} #{window_layout} #{window_flags}\" -t \"%@\"", sessionName_] -+ [gateway_ dictionaryForCommand:[NSString stringWithFormat:@"list-windows -F \"#{window_id} #{window_layout} #{window_flags}\" -t \"$%d\"", sessionId_] - responseTarget:self - responseSelector:@selector(didListWindowsSubsequentToSettingLayout:) - responseObject:nil -@@ -1777,7 +1812,7 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - responseSelector:@selector(didSetLayout:) - responseObject:nil - flags:0], -- [gateway_ dictionaryForCommand:[NSString stringWithFormat:@"list-windows -F \"#{window_id} #{window_layout} #{window_flags}\" -t \"%@\"", sessionName_] -+ [gateway_ dictionaryForCommand:[NSString stringWithFormat:@"list-windows -F \"#{window_id} #{window_layout} #{window_flags}\" -t \"$%d\"", sessionId_] - responseTarget:self - responseSelector:@selector(didListWindowsSubsequentToSettingLayout:) - responseObject:nil -@@ -1798,31 +1833,32 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - - #pragma mark - Private - --- (void)getOriginsResponse:(NSString *)result --{ -- [origins_ removeAllObjects]; -- if ([result length] > 0) { -- NSArray *windows = [result componentsSeparatedByString:@" "]; -- for (NSString *wstr in windows) { -- NSArray *tuple = [wstr componentsSeparatedByString:@":"]; -- if (tuple.count != 2) { -- continue; -- } -- NSString *windowsStr = [tuple objectAtIndex:0]; -- NSString *coords = [tuple objectAtIndex:1]; -- NSArray *windowIds = [windowsStr componentsSeparatedByString:@","]; -- NSArray *xy = [coords componentsSeparatedByString:@","]; -- if (xy.count != 2) { -- continue; -- } -- NSPoint origin = NSMakePoint([[xy objectAtIndex:0] intValue], -- [[xy objectAtIndex:1] intValue]); -- for (NSString *wid in windowIds) { -- [origins_ setObject:[NSValue valueWithPoint:origin] -- forKey:[NSNumber numberWithInt:[wid intValue]]]; -- } -- } -- } -+- (void)getOriginsResponse:(NSString *)encodedResult { -+ NSString *result = [self decodedString:encodedResult -+ optionalPrefix:iTermTmuxControllerEncodingPrefixOrigins]; -+ [origins_ removeAllObjects]; -+ if ([result length] > 0) { -+ NSArray *windows = [result componentsSeparatedByString:@" "]; -+ for (NSString *wstr in windows) { -+ NSArray *tuple = [wstr componentsSeparatedByString:@":"]; -+ if (tuple.count != 2) { -+ continue; -+ } -+ NSString *windowsStr = [tuple objectAtIndex:0]; -+ NSString *coords = [tuple objectAtIndex:1]; -+ NSArray *windowIds = [windowsStr componentsSeparatedByString:@","]; -+ NSArray *xy = [coords componentsSeparatedByString:@","]; -+ if (xy.count != 2) { -+ continue; -+ } -+ NSPoint origin = NSMakePoint([[xy objectAtIndex:0] intValue], -+ [[xy objectAtIndex:1] intValue]); -+ for (NSString *wid in windowIds) { -+ [origins_ setObject:[NSValue valueWithPoint:origin] -+ forKey:[NSNumber numberWithInt:[wid intValue]]]; -+ } -+ } -+ } - } - - - (NSString *)shortStringForHotkeyDictionary:(NSDictionary *)dict paneID:(int)wp { -@@ -1851,7 +1887,8 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - return [parts componentsJoinedByString:@" "]; - } - --- (void)getHotkeysResponse:(NSString *)result { -+- (void)getHotkeysResponse:(NSString *)encodedResult { -+ NSString *result = [self decodedString:encodedResult optionalPrefix:iTermTmuxControllerEncodingPrefixHotkeys]; - [_hotkeys removeAllObjects]; - if (result.length > 0) { - [_hotkeys removeAllObjects]; -@@ -1870,7 +1907,9 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - } - } - --- (void)getTabColorsResponse:(NSString *)result { -+- (void)getTabColorsResponse:(NSString *)encodedResult { -+ NSString *result = [self decodedString:encodedResult -+ optionalPrefix:iTermTmuxControllerEncodingPrefixTabColors]; - [_tabColors removeAllObjects]; - if (result.length > 0) { - [_tabColors removeAllObjects]; -@@ -1903,14 +1942,15 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - response = @""; - } - TSVDocument *doc = [response tsvDocumentWithFields:[self listWindowFields]]; -- id object = [userData objectAtIndex:0]; -- SEL selector = NSSelectorFromString([userData objectAtIndex:1]); -- id target = [userData objectAtIndex:2]; -+ id object = userData[0]; -+ SEL selector = NSSelectorFromString(userData[1]); -+ id target = userData[2]; - [target performSelector:selector withObject:doc withObject:object]; - } - --- (void)getHiddenWindowsResponse:(NSString *)response --{ -+- (void)getHiddenWindowsResponse:(NSString *)encodedResponse { -+ NSString *response = [self decodedString:encodedResponse -+ optionalPrefix:iTermTmuxControllerEncodingPrefixHidden]; - [hiddenWindows_ removeAllObjects]; - if ([response length] > 0) { - NSArray *windowIds = [response componentsSeparatedByString:@","]; -@@ -1922,7 +1962,7 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - } - - - (void)getAffinitiesResponse:(NSString *)result { -- [self setAffinitiesFromString:result]; -+ [self setAffinitiesFromString:[self decodedString:result optionalPrefix:iTermTmuxControllerEncodingPrefixAffinities]]; - } - - - (NSArray *)componentsOfAffinities:(NSString *)affinities { -@@ -1991,9 +2031,28 @@ static NSDictionary *iTermTmuxControllerDefaultFontOverridesFromProfile(Profile - - - (void)listSessionsResponse:(NSString *)result - { -- self.sessions = [result componentsSeparatedByRegex:@"\n"]; -+ self.sessionObjects = [[result componentsSeparatedByRegex:@"\n"] mapWithBlock:^iTermTmuxSessionObject *(NSString *line) { -+ const NSInteger space = [line rangeOfString:@" "].location; -+ if (space == NSNotFound) { -+ return nil; -+ } -+ NSString *sessionID = [line substringToIndex:space]; -+ NSString *sessionName = [line substringFromIndex:space + 1]; -+ if (![sessionID hasPrefix:@"$"]) { -+ return nil; -+ } -+ NSScanner *scanner = [NSScanner scannerWithString:[sessionID substringFromIndex:1]]; -+ int sessionNumber = -1; -+ if (![scanner scanInt:&sessionNumber] || sessionNumber < 0) { -+ return nil; -+ } -+ iTermTmuxSessionObject *obj = [[[iTermTmuxSessionObject alloc] init] autorelease]; -+ obj.name = sessionName; -+ obj.number = sessionNumber; -+ return obj; -+ }]; - [[NSNotificationCenter defaultCenter] postNotificationName:kTmuxControllerSessionsDidChange -- object:self.sessions]; -+ object:nil]; - } - - - (void)listedWindowsToOpenOne:(NSString *)response -diff --git sources/TmuxDashboardController.m sources/TmuxDashboardController.m -index b83bfe6..b2ed7b7 100644 ---- sources/TmuxDashboardController.m -+++ sources/TmuxDashboardController.m -@@ -49,7 +49,7 @@ - if (self) { - [self window]; - -- [sessionsTable_ selectSessionWithName:[[self tmuxController] sessionName]]; -+ [sessionsTable_ selectSessionNumber:[[self tmuxController] sessionId]]; - [self reloadWindows]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(tmuxControllerDetached:) -@@ -140,78 +140,79 @@ - - #pragma mark TmuxSessionsTableProtocol - --- (void)renameSessionWithName:(NSString *)oldName toName:(NSString *)newName --{ -- [[self tmuxController] renameSession:oldName to:newName]; -+- (void)renameSessionWithNumber:(int)sessionNumber toName:(NSString *)newName { -+ [[self tmuxController] renameSessionNumber:sessionNumber -+ to:newName]; - } - --- (void)removeSessionWithName:(NSString *)sessionName --{ -- [[self tmuxController] killSession:sessionName]; -+- (void)removeSessionWithNumber:(int)sessionNumber { -+ [[self tmuxController] killSessionNumber:sessionNumber]; - } - --- (void)addSessionWithName:(NSString *)sessionName --{ -+- (void)addSessionWithName:(NSString *)sessionName { - [[self tmuxController] addSessionWithName:sessionName]; - } - --- (void)attachToSessionWithName:(NSString *)sessionName --{ -- [[self tmuxController] attachToSession:sessionName]; -+- (void)attachToSessionWithNumber:(int)sessionNumber { -+ [[self tmuxController] attachToSessionWithNumber:sessionNumber]; - } - --- (void)detach --{ -+- (void)detach { - [[self tmuxController] requestDetach]; - } - --- (NSString *)nameOfAttachedSession --{ -- return [[self tmuxController] sessionName]; -+- (NSNumber *)numberOfAttachedSession { -+ TmuxController *controller = [self tmuxController]; -+ if (!controller) { -+ return nil; -+ } -+ return @([controller sessionId]); - } - --- (NSArray *)sessions --{ -- return [[self tmuxController] sessions]; -+- (NSArray *)sessionsTableModelValues:(id)sender { -+ return [self.tmuxController sessionObjects]; - } - --- (void)selectedSessionChangedTo:(NSString *)newSessionName --{ -+- (NSArray *)sessionsTableObjects:(TmuxSessionsTable *)sender { -+ return [[self tmuxController] sessionObjects]; -+} -+ -+- (void)selectedSessionDidChange { - [windowsTable_ setWindows:[NSArray array]]; - [self reloadWindows]; - } - - - (void)linkWindowId:(int)windowId -- inSession:(NSString *)sessionName -- toSession:(NSString *)targetSession --{ -+ inSessionNumber:(int)sourceSessionNumber -+ toSessionNumber:(int)targetSessionNumber { - [[self tmuxController] linkWindowId:windowId -- inSession:sessionName -- toSession:targetSession]; -+ inSessionNumber:sourceSessionNumber -+ toSessionNumber:targetSessionNumber]; - } - - - (void)moveWindowId:(int)windowId -- inSession:(NSString *)sessionName -- toSession:(NSString *)targetSession --{ -+ inSessionNumber:(int)sessionNumber -+ toSessionNumber:(int)targetSessionNumber { - [[self tmuxController] moveWindowId:windowId -- inSession:sessionName -- toSession:targetSession]; -+ inSessionNumber:sessionNumber -+ toSessionNumber:targetSessionNumber]; - } - - #pragma mark TmuxWindowsTableProtocol - --- (void)reloadWindows --{ -- [[self tmuxController] listWindowsInSession:[sessionsTable_ selectedSessionName] -- target:self -- selector:@selector(setWindows:forSession:) -- object:[sessionsTable_ selectedSessionName]]; -+- (void)reloadWindows { -+ NSNumber *sessionNumber = [sessionsTable_ selectedSessionNumber]; -+ if (!sessionNumber) { -+ return; -+ } -+ [[self tmuxController] listWindowsInSessionNumber:sessionNumber.intValue -+ target:self -+ selector:@selector(setWindows:forSession:) -+ object:[sessionsTable_ selectedSessionNumber]]; - } - --- (void)setWindows:(TSVDocument *)doc forSession:(NSString *)sessionName --{ -- if ([sessionName isEqualToString:[sessionsTable_ selectedSessionName]]) { -+- (void)setWindows:(TSVDocument *)doc forSession:(NSNumber *)sessionNumber { -+ if ([sessionNumber isEqual:[sessionsTable_ selectedSessionNumber]]) { - NSMutableArray *windows = [NSMutableArray array]; - for (NSArray *record in doc.records) { - [windows addObject:[NSMutableArray arrayWithObjects: -@@ -223,18 +224,19 @@ - } - } - --- (void)renameWindowWithId:(int)windowId toName:(NSString *)newName --{ -+- (void)renameWindowWithId:(int)windowId toName:(NSString *)newName { -+ NSNumber *sessionNumber = [sessionsTable_ selectedSessionNumber]; -+ if (!sessionNumber) { -+ return; -+ } - [[self tmuxController] renameWindowWithId:windowId -- inSession:[sessionsTable_ selectedSessionName] -+ inSessionNumber:sessionNumber - toName:newName]; - [self reloadWindows]; - } - --- (void)unlinkWindowWithId:(int)windowId --{ -- [[self tmuxController] unlinkWindowWithId:windowId -- inSession:[sessionsTable_ selectedSessionName]]; -+- (void)unlinkWindowWithId:(int)windowId { -+ [[self tmuxController] unlinkWindowWithId:windowId]; - [self reloadWindows]; - } - -@@ -242,15 +244,14 @@ - NSString *lastName = [[windowsTable_ names] lastObject]; - if (lastName) { - TmuxController *tmuxController = self.tmuxController; -- [tmuxController newWindowInSession:[sessionsTable_ selectedSessionName] -- scope:[iTermVariableScope globalsScope] -- initialDirectory:[iTermInitialDirectory initialDirectoryFromProfile:tmuxController.sharedProfile -- objectType:iTermWindowObject]]; -+ [tmuxController newWindowInSessionNumber:[sessionsTable_ selectedSessionNumber] -+ scope:[iTermVariableScope globalsScope] -+ initialDirectory:[iTermInitialDirectory initialDirectoryFromProfile:tmuxController.sharedProfile -+ objectType:iTermWindowObject]]; - } - } - --- (void)showWindowsWithIds:(NSArray *)windowIds inTabs:(BOOL)inTabs --{ -+- (void)showWindowsWithIds:(NSArray *)windowIds inTabs:(BOOL)inTabs { - if (inTabs) { - for (NSNumber *wid in windowIds) { - [[self tmuxController] openWindowWithId:[wid intValue] -@@ -265,27 +266,24 @@ - profile:self.tmuxController.sharedProfile]; - } - } -- [[self tmuxController] saveHiddenWindows]; -+ [[self tmuxController] saveHiddenWindows]; - } - - - (void)hideWindowWithId:(int)windowId - { -- [[self tmuxController] hideWindow:windowId]; -+ [[self tmuxController] hideWindow:windowId]; - [windowsTable_ updateEnabledStateOfButtons]; - } - --- (BOOL)haveSelectedSession --{ -- return [sessionsTable_ selectedSessionName] != nil; -+- (BOOL)haveSelectedSession { -+ return [sessionsTable_ selectedSessionNumber] != nil; - } - --- (BOOL)currentSessionSelected --{ -- return [[sessionsTable_ selectedSessionName] isEqualToString:[[self tmuxController] sessionName]]; -+- (BOOL)currentSessionSelected { -+ return [[sessionsTable_ selectedSessionNumber] isEqual:@([[self tmuxController] sessionId])]; - } - --- (BOOL)haveOpenWindowWithId:(int)windowId --{ -+- (BOOL)haveOpenWindowWithId:(int)windowId { - return [[self tmuxController] window:windowId] != nil; - } - -@@ -294,48 +292,41 @@ - [tab.activeSession reveal]; - } - --- (NSString *)selectedSessionName --{ -- return [sessionsTable_ selectedSessionName]; -+- (NSNumber *)selectedSessionNumber { -+ return [sessionsTable_ selectedSessionNumber]; - } - - #pragma mark - Private - --- (void)tmuxControllerDetached:(NSNotification *)notification --{ -- [sessionsTable_ setSessions:[NSArray array]]; -+- (void)tmuxControllerDetached:(NSNotification *)notification { -+ [sessionsTable_ setSessionObjects:@[]]; - } - --- (void)tmuxControllerSessionsDidChange:(NSNotification *)notification --{ -- [sessionsTable_ setSessions:[[self tmuxController] sessions]]; -+- (void)tmuxControllerSessionsDidChange:(NSNotification *)notification { -+ [sessionsTable_ setSessionObjects:[[self tmuxController] sessionObjects]]; - } - --- (void)tmuxControllerWindowsDidChange:(NSNotification *)notification --{ -+- (void)tmuxControllerWindowsDidChange:(NSNotification *)notification { - if ([[self window] isVisible]) { - [self reloadWindows]; - } - } - --- (void)tmuxControllerAttachedSessionChanged:(NSNotification *)notification --{ -+- (void)tmuxControllerAttachedSessionChanged:(NSNotification *)notification { - if ([[self window] isVisible]) { -- [sessionsTable_ selectSessionWithName:[[self tmuxController] sessionName]]; -+ [sessionsTable_ selectSessionNumber:[[self tmuxController] sessionId]]; - [windowsTable_ updateEnabledStateOfButtons]; - } - } - --- (void)tmuxControllerWindowOpenedOrClosed:(NSNotification *)notification --{ -+- (void)tmuxControllerWindowOpenedOrClosed:(NSNotification *)notification { - if ([[self window] isVisible]) { - [windowsTable_ updateEnabledStateOfButtons]; - [windowsTable_ reloadData]; - } - } - --- (void)tmuxControllerWindowWasRenamed:(NSNotification *)notification --{ -+- (void)tmuxControllerWindowWasRenamed:(NSNotification *)notification { - if ([[self window] isVisible]) { - NSArray *objects = [notification object]; - int wid = [[objects objectAtIndex:0] intValue]; -@@ -344,8 +335,7 @@ - } - } - --- (void)tmuxControllerSessionWasRenamed:(NSNotification *)notification --{ -+- (void)tmuxControllerSessionWasRenamed:(NSNotification *)notification { - // This is a bit of extra work but the sessions table wasn't built knowing about session IDs. - [[self tmuxController] listSessions]; - } -@@ -364,8 +354,7 @@ - [self connectionSelectionDidChange:nil]; - } - --- (TmuxController *)tmuxController --{ -+- (TmuxController *)tmuxController { - return [[TmuxControllerRegistry sharedInstance] controllerForClient:[self currentClient]]; // TODO: track the current client when multiples are supported - } - -@@ -375,7 +364,7 @@ - - - - (IBAction)connectionSelectionDidChange:(id)sender { -- [sessionsTable_ setSessions:[[self tmuxController] sessions]]; -+ [sessionsTable_ setSessionObjects:[[self tmuxController] sessionObjects]]; - [self reloadWindows]; - } - -diff --git sources/TmuxSessionsTable.h sources/TmuxSessionsTable.h -index 856f0f5..a3e5823 100644 ---- sources/TmuxSessionsTable.h -+++ sources/TmuxSessionsTable.h -@@ -9,21 +9,25 @@ - #import - #import "FutureMethods.h" - -+@class TmuxSessionsTable; -+@class iTermTmuxSessionObject; -+ - @protocol TmuxSessionsTableProtocol - --- (NSArray *)sessions; --- (void)renameSessionWithName:(NSString *)oldName toName:(NSString *)newName; --- (void)removeSessionWithName:(NSString *)sessionName; -+- (NSArray *)sessionsTableObjects:(TmuxSessionsTable *)sender; -+- (void)renameSessionWithNumber:(int)sessionNumber -+ toName:(NSString *)newName; -+- (void)removeSessionWithNumber:(int)sessionNumber; - - (void)addSessionWithName:(NSString *)sessionName; --- (void)attachToSessionWithName:(NSString *)sessionName; --- (NSString *)nameOfAttachedSession; --- (void)selectedSessionChangedTo:(NSString *)newName; -+- (void)attachToSessionWithNumber:(int)sessionNumber; -+- (NSNumber *)numberOfAttachedSession; -+- (void)selectedSessionDidChange; - - (void)linkWindowId:(int)windowId -- inSession:(NSString *)sessionName -- toSession:(NSString *)targetSession; -+ inSessionNumber:(int)sourceSessionNumber -+ toSessionNumber:(int)targetSessionNumber; - - (void)moveWindowId:(int)windowId -- inSession:(NSString *)sessionName -- toSession:(NSString *)targetSession; -+ inSessionNumber:(int)sessionNumber -+ toSessionNumber:(int)targetSessionNumber; - - (void)detach; - - @end -@@ -31,9 +35,9 @@ - @interface TmuxSessionsTable : NSObject - - @property(nonatomic, assign) id delegate; --@property(nonatomic, readonly) NSString *selectedSessionName; -+@property(nonatomic, readonly) NSNumber *selectedSessionNumber; - --- (void)setSessions:(NSArray *)names; --- (void)selectSessionWithName:(NSString *)name; -+- (void)setSessionObjects:(NSArray *)names; -+- (void)selectSessionNumber:(int)number; - - @end -diff --git sources/TmuxSessionsTable.m sources/TmuxSessionsTable.m -index f9a086f..88e2f72 100644 ---- sources/TmuxSessionsTable.m -+++ sources/TmuxSessionsTable.m -@@ -7,12 +7,15 @@ - // - - #import "TmuxSessionsTable.h" -+ - #import "FutureMethods.h" -+#import "iTermTmuxSessionObject.h" -+#import "NSArray+iTerm.h" - - extern NSString *kWindowPasteboardType; - - @implementation TmuxSessionsTable { -- NSMutableArray *model_; -+ NSMutableArray *_model; - BOOL canAttachToSelectedSession_; - - IBOutlet NSTableColumn *checkColumn_; -@@ -28,7 +31,7 @@ extern NSString *kWindowPasteboardType; - - (instancetype)init { - self = [super init]; - if (self) { -- model_ = [[NSMutableArray alloc] init]; -+ _model = [[NSMutableArray alloc] init]; - } - return self; - } -@@ -39,27 +42,27 @@ extern NSString *kWindowPasteboardType; - [tableView_ setDraggingDestinationFeedbackStyle:NSTableViewDraggingDestinationFeedbackStyleRegular]; - } - --- (void)dealloc --{ -- [model_ release]; -+- (void)dealloc { -+ [_model release]; - [super dealloc]; - } - - - (void)setDelegate:(id)delegate { - delegate_ = delegate; -- [self setSessions:[delegate_ sessions]]; -+ [self setSessionObjects:[delegate_ sessionsTableObjects:self]]; - } - --- (void)setSessions:(NSArray *)names -+- (void)setSessionObjects:(NSArray *)sessions - { -- [model_ removeAllObjects]; -- [model_ addObjectsFromArray:names]; -+ [_model removeAllObjects]; -+ [_model addObjectsFromArray:sessions]; - [tableView_ reloadData]; - } - --- (void)selectSessionWithName:(NSString *)name --{ -- NSUInteger i = [model_ indexOfObject:name]; -+- (void)selectSessionNumber:(int)number { -+ NSInteger i = [_model indexOfObjectPassingTest:^BOOL(iTermTmuxSessionObject * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { -+ return obj.number == number; -+ }]; - if (i != NSNotFound) { - [tableView_ selectRowIndexes:[NSIndexSet indexSetWithIndex:i] - byExtendingSelection:NO]; -@@ -74,47 +77,45 @@ extern NSString *kWindowPasteboardType; - - - (IBAction)removeSession:(id)sender - { -- NSString *name = [self selectedSessionName]; -- if (name) { -- [delegate_ removeSessionWithName:name]; -+ NSNumber *number = [self selectedSessionNumber]; -+ if (number) { -+ [delegate_ removeSessionWithNumber:number.intValue]; - } - } - - - (IBAction)attach:(id)sender { -- NSString *name = [self selectedSessionName]; -- if (name) { -- [delegate_ attachToSessionWithName:name]; -+ NSNumber *number = [self selectedSessionNumber]; -+ if (number) { -+ [delegate_ attachToSessionWithNumber:number.intValue]; - } - } - - - (IBAction)detach:(id)sender { -- NSString *name = [self selectedSessionName]; -- if (name) { -+ NSNumber *number = [self selectedSessionNumber]; -+ if (number) { - [delegate_ detach]; - } - } - - #pragma mark NSTableViewDataSource - --- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView --{ -- return model_.count; -+- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView { -+ return _model.count; - } - - - (id)tableView:(NSTableView *)aTableView - objectValueForTableColumn:(NSTableColumn *)aTableColumn -- row:(NSInteger)rowIndex --{ -- NSString *name = [model_ objectAtIndex:rowIndex]; -+ row:(NSInteger)rowIndex { -+ iTermTmuxSessionObject *sessionObject = _model[rowIndex]; - if (aTableColumn == checkColumn_) { -- if ([[delegate_ nameOfAttachedSession] isEqualToString:name]) { -+ if ([[delegate_ numberOfAttachedSession] isEqual:@(sessionObject.number)]) { - return @"✓"; - } else { - return @""; - } - } else { -- if (rowIndex < model_.count) { -- return name; -+ if (rowIndex < _model.count) { -+ return sessionObject.name; - } else { - return nil; - } -@@ -124,10 +125,9 @@ extern NSString *kWindowPasteboardType; - - (void)tableView:(NSTableView *)aTableView - setObjectValue:(id)anObject - forTableColumn:(NSTableColumn *)aTableColumn -- row:(NSInteger)rowIndex --{ -- [delegate_ renameSessionWithName:[model_ objectAtIndex:rowIndex] -- toName:(NSString *)anObject]; -+ row:(NSInteger)rowIndex { -+ [delegate_ renameSessionWithNumber:_model[rowIndex].number -+ toName:(NSString *)anObject]; - } - - #pragma mark NSTableViewDataSource -@@ -138,16 +138,15 @@ extern NSString *kWindowPasteboardType; - return YES; - } - --- (void)tableViewSelectionDidChange:(NSNotification *)aNotification --{ -+- (void)tableViewSelectionDidChange:(NSNotification *)aNotification { - [self updateEnabledStateOfButtons]; -- [delegate_ selectedSessionChangedTo:[self selectedSessionName]]; -+ [delegate_ selectedSessionDidChange]; - } - --- (NSString *)selectedSessionName { -+- (NSNumber *)selectedSessionNumber { - int i = [tableView_ selectedRow]; -- if (i >= 0 && i < model_.count) { -- return [model_ objectAtIndex:i]; -+ if (i >= 0 && i < _model.count) { -+ return @(_model[i].number); - } else { - return nil; - } -@@ -159,19 +158,19 @@ extern NSString *kWindowPasteboardType; - dropOperation:(NSTableViewDropOperation)operation { - NSPasteboard *pb = [info draggingPasteboard]; - NSArray* pair = [pb propertyListForType:kWindowPasteboardType]; -- NSString *sessionName = [pair objectAtIndex:0]; -- NSArray *draggedItems = [pair objectAtIndex:1]; -- NSString *targetSession = [model_ objectAtIndex:row]; -+ NSNumber *sessionNumber = pair[0]; -+ NSArray *draggedItems = pair[1]; -+ iTermTmuxSessionObject *targetSessionObject = _model[row]; - for (NSArray *tuple in draggedItems) { - NSNumber *windowId = [tuple objectAtIndex:1]; - if (info.draggingSourceOperationMask & NSDragOperationLink) { - [delegate_ linkWindowId:[windowId intValue] -- inSession:sessionName -- toSession:targetSession]; -+ inSessionNumber:sessionNumber.intValue -+ toSessionNumber:targetSessionObject.number]; - } else { - [delegate_ moveWindowId:[windowId intValue] -- inSession:sessionName -- toSession:targetSession]; -+ inSessionNumber:sessionNumber.intValue -+ toSessionNumber:targetSessionObject.number]; - } - } - return YES; -@@ -205,11 +204,16 @@ extern NSString *kWindowPasteboardType; - } - } - --- (NSString *)nameForNewSession --{ -+- (BOOL)haveSessionWithName:(NSString *)name { -+ return [_model anyWithBlock:^BOOL(iTermTmuxSessionObject *anObject) { -+ return [anObject.name isEqualToString:name]; -+ }]; -+} -+ -+- (NSString *)nameForNewSession { - int n = 0; - NSString *candidate = [self nameForNewSessionWithNumber:n]; -- while ([model_ indexOfObject:candidate] != NSNotFound) { -+ while ([self haveSessionWithName:candidate]) { - n++; - candidate = [self nameForNewSessionWithNumber:n]; - } -@@ -223,7 +227,9 @@ extern NSString *kWindowPasteboardType; - [detachButton_ setEnabled:NO]; - [removeButton_ setEnabled:NO]; - } else { -- BOOL isAttachedSession = [[delegate_ nameOfAttachedSession] isEqualToString:[self selectedSessionName]]; -+ NSNumber *selected = [self selectedSessionNumber]; -+ BOOL isAttachedSession = (selected != nil && -+ [[delegate_ numberOfAttachedSession] isEqual:@(selected.intValue)]); - [attachButton_ setEnabled:!isAttachedSession]; - [detachButton_ setEnabled:isAttachedSession]; - [removeButton_ setEnabled:YES]; -diff --git sources/TmuxWindowsTable.h sources/TmuxWindowsTable.h -index 7c3e16c..6e9604e 100644 ---- sources/TmuxWindowsTable.h -+++ sources/TmuxWindowsTable.h -@@ -22,7 +22,7 @@ extern NSString *kWindowPasteboardType; - - (BOOL)haveSelectedSession; - - (BOOL)currentSessionSelected; - - (BOOL)haveOpenWindowWithId:(int)windowId; --- (NSString *)selectedSessionName; -+- (NSNumber *)selectedSessionNumber; - - (void)tmuxWindowsTableDidSelectWindowWithId:(int)windowId; - - @end -diff --git sources/TmuxWindowsTable.m sources/TmuxWindowsTable.m -index 56f4954..8f92993 100644 ---- sources/TmuxWindowsTable.m -+++ sources/TmuxWindowsTable.m -@@ -173,9 +173,9 @@ NSString *kWindowPasteboardType = @"kWindowPasteboardType"; - - (void)tableView:(NSTableView *)aTableView - setObjectValue:(id)anObject - forTableColumn:(NSTableColumn *)aTableColumn -- row:(NSInteger)rowIndex --{ -- [delegate_ renameWindowWithId:[[[[self filteredModel] objectAtIndex:rowIndex] objectAtIndex:1] intValue] -+ row:(NSInteger)rowIndex { -+ const int windowID = [[[[self filteredModel] objectAtIndex:rowIndex] objectAtIndex:1] intValue]; -+ [delegate_ renameWindowWithId:windowID - toName:anObject]; - } - -@@ -200,7 +200,7 @@ NSString *kWindowPasteboardType = @"kWindowPasteboardType"; - NSArray* selectedItems = [[self filteredModel] objectsAtIndexes:rowIndexes]; - [pboard declareTypes:[NSArray arrayWithObject:kWindowPasteboardType] owner:self]; - [pboard setPropertyList:[NSArray arrayWithObjects: -- [delegate_ selectedSessionName], -+ [delegate_ selectedSessionNumber], - selectedItems, - nil] - forType:kWindowPasteboardType]; -@@ -219,14 +219,13 @@ NSString *kWindowPasteboardType = @"kWindowPasteboardType"; - - #pragma mark - Private - --- (NSArray *)selectedWindowIdsAsStrings --{ -- NSArray *ids = [self selectedWindowIds]; -+- (NSArray *)selectedWindowIdsAsStrings { -+ NSArray *ids = [self selectedWindowIds]; - NSMutableArray *result = [NSMutableArray array]; -- for (NSString *n in ids) { -- [result addObject:n]; -- } -- return result; -+ for (NSString *n in ids) { -+ [result addObject:n]; -+ } -+ return result; - } - - - (NSArray *)selectedWindowIds -diff --git sources/iTermInitialDirectory+Tmux.h sources/iTermInitialDirectory+Tmux.h -index a470a56..586ade6 100644 ---- sources/iTermInitialDirectory+Tmux.h -+++ sources/iTermInitialDirectory+Tmux.h -@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN - - @interface iTermInitialDirectory (Tmux) - --- (void)tmuxNewWindowCommandInSession:(nullable NSString *)session -+- (void)tmuxNewWindowCommandInSessionNumber:(nullable NSNumber *)sessionNumber - recyclingSupported:(BOOL)recyclingSupported - scope:(iTermVariableScope *)scope - completion:(void (^)(NSString *))completion; -diff --git sources/iTermInitialDirectory+Tmux.m sources/iTermInitialDirectory+Tmux.m -index a67bea4..3259eda 100644 ---- sources/iTermInitialDirectory+Tmux.m -+++ sources/iTermInitialDirectory+Tmux.m -@@ -11,14 +11,14 @@ - - @implementation iTermInitialDirectory(Tmux) - --- (void)tmuxNewWindowCommandInSession:(NSString *)session -- recyclingSupported:(BOOL)recyclingSupported -- scope:(iTermVariableScope *)scope -- completion:(void (^)(NSString *))completion { -+- (void)tmuxNewWindowCommandInSessionNumber:(nullable NSNumber *)sessionNumber -+ recyclingSupported:(BOOL)recyclingSupported -+ scope:(iTermVariableScope *)scope -+ completion:(void (^)(NSString *))completion { - NSArray *args = @[ @"new-window", @"-PF '#{window_id}'" ]; - -- if (session) { -- NSString *targetSessionArg = [NSString stringWithFormat:@"\"%@:+\"", [session stringByEscapingQuotes]]; -+ if (sessionNumber) { -+ NSString *targetSessionArg = [NSString stringWithFormat:@"\"$%d:+\"", sessionNumber.intValue]; - NSArray *insertionArguments = @[ @"-a", - @"-t", - targetSessionArg ]; -@@ -33,10 +33,10 @@ - - (void)tmuxNewWindowCommandRecyclingSupported:(BOOL)recyclingSupported - scope:(iTermVariableScope *)scope - completion:(void (^)(NSString *))completion { -- [self tmuxNewWindowCommandInSession:nil -- recyclingSupported:recyclingSupported -- scope:scope -- completion:completion]; -+ [self tmuxNewWindowCommandInSessionNumber:nil -+ recyclingSupported:recyclingSupported -+ scope:scope -+ completion:completion]; - } - - - (void)tmuxSplitWindowCommand:(int)wp -diff --git sources/iTermTmuxOptionMonitor.h sources/iTermTmuxOptionMonitor.h -index 147fcd6..8dffe52 100644 ---- sources/iTermTmuxOptionMonitor.h -+++ sources/iTermTmuxOptionMonitor.h -@@ -18,8 +18,12 @@ NS_ASSUME_NONNULL_BEGIN - @property (nullable, nonatomic, strong) iTermVariableScope *scope; - - - (instancetype)init NS_UNAVAILABLE; -+ -+// If `fallbackVariableName` is nonnil, the value of the variable named -+// `fallbackVariableName` will be used for tmux 2.8 and earlier. - - (instancetype)initWithGateway:(TmuxGateway *)gateway - scope:(iTermVariableScope *)scope -+ fallbackVariableName:(nullable NSString *)fallbackVariableName - format:(NSString *)format - target:(NSString *)tmuxTarget - variableName:(nullable NSString *)variableName -diff --git sources/iTermTmuxOptionMonitor.m sources/iTermTmuxOptionMonitor.m -index 4f72d02..fd6120f 100644 ---- sources/iTermTmuxOptionMonitor.m -+++ sources/iTermTmuxOptionMonitor.m -@@ -10,6 +10,7 @@ - #import "DebugLogging.h" - #import "iTermVariables.h" - #import "iTermVariableScope+Session.h" -+#import "NSStringITerm.h" - #import "NSTimer+iTerm.h" - #import "TmuxGateway.h" - -@@ -19,11 +20,13 @@ - BOOL _haveOutstandingRequest; - NSString *_target; - NSString *_variableName; -+ NSString *_fallbackVariableName; - void (^_block)(NSString *); - } - - - (instancetype)initWithGateway:(TmuxGateway *)gateway - scope:(iTermVariableScope *)scope -+ fallbackVariableName:(NSString *)fallbackVariableName - format:(NSString *)format - target:(NSString *)target - variableName:(NSString *)variableName -@@ -36,6 +39,7 @@ - _target = [target copy]; - _variableName = [variableName copy]; - _block = [block copy]; -+ _fallbackVariableName = [fallbackVariableName copy]; - } - return self; - } -@@ -64,13 +68,21 @@ - [self updateOnce]; - } - -+- (NSString *)command { -+ return [NSString stringWithFormat:@"display-message -t '%@' -p '%@'", _target, self.escapedFormat]; -+} -+ - - (void)updateOnce { - if (_haveOutstandingRequest) { - DLog(@"Not making a request because one is outstanding"); - return; - } -+ if (_fallbackVariableName && self.gateway.minimumServerVersion.doubleValue <= 2.9) { -+ [self didFetch:[self.scope valueForVariableName:_fallbackVariableName]]; -+ return; -+ } - _haveOutstandingRequest = YES; -- NSString *command = [NSString stringWithFormat:@"display-message -t '%@' -p '%@'", _target, self.escapedFormat]; -+ NSString *command = [self command]; - DLog(@"Request option with command %@", command); - [self.gateway sendCommand:command - responseTarget:self -@@ -80,7 +92,7 @@ - } - - - (void)didFetch:(NSString *)value { -- DLog(@"Did fetch %@", value); -+ DLog(@"%@ -> %@", self.command, value); - if (!value) { - // Probably the pane went away and we'll be dealloced soon. - return; -diff --git sources/iTermTmuxSessionObject.h sources/iTermTmuxSessionObject.h -new file mode 100644 -index 0000000..6407d5f ---- /dev/null -+++ sources/iTermTmuxSessionObject.h -@@ -0,0 +1,17 @@ -+// -+// iTermTmuxSessionObject.h -+// iTerm2SharedARC -+// -+// Created by George Nachman on 9/25/19. -+// -+ -+#import -+ -+NS_ASSUME_NONNULL_BEGIN -+ -+@interface iTermTmuxSessionObject : NSObject -+@property (nonatomic, copy) NSString *name; -+@property (nonatomic) int number; -+@end -+ -+NS_ASSUME_NONNULL_END -diff --git sources/iTermTmuxSessionObject.m sources/iTermTmuxSessionObject.m -new file mode 100644 -index 0000000..5ac9130 ---- /dev/null -+++ sources/iTermTmuxSessionObject.m -@@ -0,0 +1,12 @@ -+// -+// iTermTmuxSessionObject.m -+// iTerm2SharedARC -+// -+// Created by George Nachman on 9/25/19. -+// -+ -+#import "iTermTmuxSessionObject.h" -+ -+@implementation iTermTmuxSessionObject -+ -+@end -diff --git sources/iTermTmuxStatusBarMonitor.h sources/iTermTmuxStatusBarMonitor.h -index 8172779..96338ec 100644 ---- sources/iTermTmuxStatusBarMonitor.h -+++ sources/iTermTmuxStatusBarMonitor.h -@@ -14,6 +14,7 @@ - - NS_ASSUME_NONNULL_BEGIN - -+// NOTE: Requires tmux 2.9 - @interface iTermTmuxStatusBarMonitor : NSObject - - @property (nonatomic) BOOL active; -diff --git sources/iTermTmuxStatusBarMonitor.m sources/iTermTmuxStatusBarMonitor.m -index 50504da..0d3daf3 100644 ---- sources/iTermTmuxStatusBarMonitor.m -+++ sources/iTermTmuxStatusBarMonitor.m -@@ -9,6 +9,7 @@ - - #import "DebugLogging.h" - #import "iTermVariableScope.h" -+#import "NSStringITerm.h" - #import "NSTimer+iTerm.h" - #import "TmuxGateway.h" - #import "RegexKitLite.h" -@@ -49,13 +50,8 @@ - - - (void)requestUpdates { - _accelerated = NO; -- [_gateway sendCommand:@"display-message -p \"#{status-left}\"" responseTarget:self responseSelector:@selector(handleStatusLeftResponse:)]; -- [_gateway sendCommand:@"display-message -p \"#{status-right}\"" responseTarget:self responseSelector:@selector(handleStatusRightResponse:)]; --} -- --- (NSString *)escapedString:(NSString *)string { -- return [[string stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"] -- stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]; -+ [_gateway sendCommand:@"display-message -p \"#{T:status-left}\"" responseTarget:self responseSelector:@selector(handleStatusLeftValueExpansionResponse:)]; -+ [_gateway sendCommand:@"display-message -p \"#{T:status-right}\"" responseTarget:self responseSelector:@selector(handleStatusRightValueExpansionResponse:)]; - } - - - (void)handleStatusIntervalResponse:(NSString *)response { -@@ -66,28 +62,14 @@ - _timer = [NSTimer scheduledWeakTimerWithTimeInterval:interval target:self selector:@selector(timerDidFire:) userInfo:nil repeats:YES]; - } - --- (void)handleStatusLeftResponse:(NSString *)response { -- if (!response) { -- return; -- } -- NSString *command = [NSString stringWithFormat:@"display-message -p \"%@\"", [self escapedString:response]]; -- [_gateway sendCommand:command responseTarget:self responseSelector:@selector(handleStatusLeftValueExpansionResponse:)]; --} -- --- (void)handleStatusRightResponse:(NSString *)response { -- if (!response) { -- return; -- } -- NSString *command = [NSString stringWithFormat:@"display-message -p \"%@\"", [self escapedString:response]]; -- [_gateway sendCommand:command responseTarget:self responseSelector:@selector(handleStatusRightValueExpansionResponse:)]; --} -- - - (void)handleStatusLeftValueExpansionResponse:(NSString *)string { -+ DLog(@"Left status bar is: %@", string); - [self.scope setValue:[self sanitizedString:string] ?: @"" forVariableNamed:iTermVariableKeySessionTmuxStatusLeft]; - [self accelerateUpdateIfStringContainsNotReady:string]; - } - - - (void)handleStatusRightValueExpansionResponse:(NSString *)string { -+ DLog(@"Right status bar is: %@", string); - [self.scope setValue:[self sanitizedString:string] ?: @"" forVariableNamed:iTermVariableKeySessionTmuxStatusRight]; - [self accelerateUpdateIfStringContainsNotReady:string]; - } -diff --git sources/iTermWorkingDirectoryPoller.m sources/iTermWorkingDirectoryPoller.m -index 5271227..f4d8602 100644 ---- sources/iTermWorkingDirectoryPoller.m -+++ sources/iTermWorkingDirectoryPoller.m -@@ -37,6 +37,7 @@ - __weak __typeof(self) weakSelf = self; - _tmuxOptionMonitor = [[iTermTmuxOptionMonitor alloc] initWithGateway:gateway - scope:scope -+ fallbackVariableName:nil - format:@"#{pane_current_path}" - target:[NSString stringWithFormat:@"%%%@", @(windowPane)] - variableName:nil --- -2.23.0 - diff --git a/aqua/iTerm2/files/patch-Makefile-XC10.diff b/aqua/iTerm2/files/patch-Makefile-XC10.diff deleted file mode 100644 index 7b2011d0c912c..0000000000000 --- a/aqua/iTerm2/files/patch-Makefile-XC10.diff +++ /dev/null @@ -1,26 +0,0 @@ -Declare dependencies so we don't unnecessarily rebuild when running "make install" ---- Makefile.orig 2018-10-29 12:31:47.000000000 -0400 -+++ Makefile 2018-11-04 14:07:03.000000000 -0500 -@@ -21,7 +21,7 @@ - find . -name "*.[mhMH]" -exec etags -o ./TAGS -a '{}' + - - install: | Deployment backup-old-iterm -- cp -R build/Deployment/iTerm2.app $(APPS) -+ cp -R DerivedData/Build/Products/Deployment/iTerm2.app $(APPS) - - Development: - echo "Using PATH for build: $(PATH)" -@@ -36,9 +36,10 @@ - xcodebuild -parallelizeTargets -target iTerm2 -configuration Beta && \ - chmod -R go+rX build/Beta - --Deployment: -- xcodebuild -parallelizeTargets -target iTerm2 -configuration Deployment && \ -- chmod -R go+rX build/Deployment -+Deployment: build/Deployment/iTerm2.app/Contents/MacOS/iTerm2 -+build/Deployment/iTerm2.app/Contents/MacOS/iTerm2: -+ xcodebuild -parallelizeTargets -target iTerm2 -configuration Deployment -scheme iTerm2 -derivedDataPath ./DerivedData && \ -+ chmod -R go+rX DerivedData/Build/Products/Deployment - - Nightly: force - cp plists/nightly-iTerm2.plist plists/iTerm2.plist diff --git a/aqua/iTerm2/files/patch-Makefile.diff b/aqua/iTerm2/files/patch-Makefile.diff deleted file mode 100644 index 6a3fade589e71..0000000000000 --- a/aqua/iTerm2/files/patch-Makefile.diff +++ /dev/null @@ -1,13 +0,0 @@ -Declare dependencies so we don't unnecessarily rebuild when running "make install" ---- Makefile.orig 2016-07-11 17:10:54.000000000 -0500 -+++ Makefile 2016-08-01 23:05:10.000000000 -0500 -@@ -31,7 +31,8 @@ - Dep: - xcodebuild -parallelizeTargets -target iTerm2 -configuration Deployment - --Deployment: -+Deployment: build/Deployment/iTerm2.app/Contents/MacOS/iTerm2 -+build/Deployment/iTerm2.app/Contents/MacOS/iTerm2: - xcodebuild -parallelizeTargets -target iTerm2 -configuration Deployment && \ - chmod -R go+rX build/Deployment - diff --git a/aqua/iTerm2/files/patch-nsur.diff b/aqua/iTerm2/files/patch-nsur.diff deleted file mode 100644 index 869a4b014eeea..0000000000000 --- a/aqua/iTerm2/files/patch-nsur.diff +++ /dev/null @@ -1,24 +0,0 @@ -From a793c88dcfdcd17c42909d8f3ed461bc44aaa53e Mon Sep 17 00:00:00 2001 -From: Andrew Udvare -Date: Sat, 7 Nov 2020 01:32:23 -0500 -Subject: [PATCH] Guard against NS_WARN_UNUSED_RESULT not defined - ---- - sources/iTerm2.pch | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git sources/iTerm2.pch sources/iTerm2.pch -index 3108a3a09..028db831c 100644 ---- sources/iTerm2.pch -+++ sources/iTerm2.pch -@@ -5,4 +5,6 @@ _Pragma("clang diagnostic ignored \"-Wpartial-availability\"") - #define ITERM_IGNORE_PARTIAL_END \ - _Pragma("clang diagnostic pop") - -- -+#ifndef NS_WARN_UNUSED_RESULT -+#define NS_WARN_UNUSED_RESULT -+#endif --- -2.29.2 - diff --git a/aqua/iTerm2/files/patch-remove-sparkle-3.4.diff b/aqua/iTerm2/files/patch-remove-sparkle-3.4.diff deleted file mode 100644 index 5e306d1032d95..0000000000000 --- a/aqua/iTerm2/files/patch-remove-sparkle-3.4.diff +++ /dev/null @@ -1,210 +0,0 @@ -From 12ed6ad18ed8e7390b9fa6681487c75a0eb9c979 Mon Sep 17 00:00:00 2001 -From: Andrew Udvare -Date: Fri, 6 Nov 2020 16:40:20 -0500 -Subject: [PATCH] Remove update stuff - ---- - Interfaces/MainMenu.xib | 10 --------- - Interfaces/PreferencePanel.xib | 26 ---------------------- - sources/GeneralPreferencesViewController.m | 16 ------------- - sources/iTermApplicationDelegate.m | 8 ------- - sources/iTermController.m | 2 +- - sources/iTermLaunchExperienceController.m | 2 +- - sources/iTermPreferences.m | 2 +- - 7 files changed, 3 insertions(+), 63 deletions(-) - -diff --git Interfaces/MainMenu.xib Interfaces/MainMenu.xib -index 093a4958c..76521fa89 100644 ---- Interfaces/MainMenu.xib -+++ Interfaces/MainMenu.xib -@@ -28,14 +28,6 @@ - - - -- -- -- -- -- -- -- -- - - - -@@ -1336,7 +1328,6 @@ DQ - - - -- - - - -@@ -1344,7 +1335,6 @@ DQ - - - -- - - - -diff --git Interfaces/PreferencePanel.xib Interfaces/PreferencePanel.xib -index e0df82e16..e9716d6fb 100644 ---- Interfaces/PreferencePanel.xib -+++ Interfaces/PreferencePanel.xib -@@ -1225,8 +1225,6 @@ DQ - - - -- -- - - - -@@ -4832,30 +4829,6 @@ DQ - - - -- -- -- -- -- - -diff --git sources/GeneralPreferencesViewController.m sources/GeneralPreferencesViewController.m -index 572346fd9..0b437dd2f 100644 ---- sources/GeneralPreferencesViewController.m -+++ sources/GeneralPreferencesViewController.m -@@ -64,12 +64,6 @@ enum { - // Enable bonjour - IBOutlet NSButton *_enableBonjour; - -- // Check for updates automatically -- IBOutlet NSButton *_checkUpdate; -- -- // Prompt for test-release updates -- IBOutlet NSButton *_checkTestRelease; -- - // Load prefs from custom folder - IBOutlet NSButton *_loadPrefsFromCustomFolder; // Should load? - IBOutlet NSTextField *_prefsCustomFolder; // Path or URL text field -@@ -304,16 +298,6 @@ enum { - relatedView:nil - type:kPreferenceInfoTypeCheckbox]; - -- [self defineControl:_checkUpdate -- key:kPreferenceKeyCheckForUpdatesAutomatically -- relatedView:nil -- type:kPreferenceInfoTypeCheckbox]; -- -- [self defineControl:_checkTestRelease -- key:kPreferenceKeyCheckForTestReleases -- relatedView:nil -- type:kPreferenceInfoTypeCheckbox]; -- - // --------------------------------------------------------------------------------------------- - info = [self defineControl:_loadPrefsFromCustomFolder - key:kPreferenceKeyLoadPrefsFromCustomFolder -diff --git sources/iTermApplicationDelegate.m sources/iTermApplicationDelegate.m -index 1702d1cb0..20e8949f9 100644 ---- sources/iTermApplicationDelegate.m -+++ sources/iTermApplicationDelegate.m -@@ -182,7 +182,6 @@ static BOOL hasBecomeActive = NO; - IBOutlet NSMenuItem *showFullScreenTabs; - IBOutlet NSMenuItem *useTransparency; - IBOutlet NSMenuItem *maximizePane; -- IBOutlet SUUpdater * suUpdater; - IBOutlet NSMenuItem *_showTipOfTheDay; // Here because we must remove it for older OS versions. - BOOL quittingBecauseLastWindowClosed_; - -@@ -1190,11 +1189,6 @@ static BOOL hasBecomeActive = NO; - - [self updateBuriedSessionsMenu:_statusIconBuriedSessions]; - -- item = [[[NSMenuItem alloc] initWithTitle:@"Check For Updates" -- action:@selector(checkForUpdatesFromMenu:) -- keyEquivalent:@""] autorelease]; -- [menu addItem:item]; -- - item = [[[NSMenuItem alloc] initWithTitle:@"Quit iTerm2" - action:@selector(terminate:) - keyEquivalent:@""] autorelease]; -@@ -1350,7 +1344,6 @@ static BOOL hasBecomeActive = NO; - silenceable:kiTermWarningTypeSilenceableForOneMonth - window:nil]; - if (selection == kiTermWarningSelection1) { -- [[SUUpdater sharedUpdater] checkForUpdates:nil]; - } - } - } -@@ -1473,7 +1466,6 @@ static BOOL hasBecomeActive = NO; - } - - - (IBAction)checkForUpdatesFromMenu:(id)sender { -- [suUpdater checkForUpdates:(sender)]; - } - - #pragma mark - Main Menu -diff --git sources/iTermController.m sources/iTermController.m -index 5054f89d9..a5fef1132 100644 ---- sources/iTermController.m -+++ sources/iTermController.m -@@ -1175,7 +1175,7 @@ static iTermController *gSharedInstance; - } - - - (void)refreshSoftwareUpdateUserDefaults { -- BOOL checkForTestReleases = [iTermPreferences boolForKey:kPreferenceKeyCheckForTestReleases]; -+ BOOL checkForTestReleases = NO; - NSString *appCast = checkForTestReleases ? - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"SUFeedURLForTesting"] : - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"SUFeedURLForFinal"]; -diff --git sources/iTermLaunchExperienceController.m sources/iTermLaunchExperienceController.m -index 2a31322d1..d89935b0c 100644 ---- sources/iTermLaunchExperienceController.m -+++ sources/iTermLaunchExperienceController.m -@@ -110,7 +110,7 @@ typedef NS_ENUM(NSUInteger, iTermLaunchExperienceChoice) { - self = [super init]; - if (self) { - const NSInteger runCount = [iTermLaunchExperienceController incrementRunCount]; -- if (runCount == 2 && ![[SUUpdater sharedUpdater] automaticallyChecksForUpdates]) { -+ if (runCount == 2) { - // Sparkle will do its thing this launch. - _choice = iTermLaunchExperienceChoiceNone; - } else if ([iTermLaunchExperienceController quelled]) { -diff --git sources/iTermPreferences.m sources/iTermPreferences.m -index 04b1fe381..629f2377f 100644 ---- sources/iTermPreferences.m -+++ sources/iTermPreferences.m -@@ -279,7 +279,7 @@ static NSString *sPreviousVersion; - kPreferenceKeyInstantReplayMemoryMegabytes: @4, - kPreferenceKeySavePasteAndCommandHistory: @NO, - kPreferenceKeyAddBonjourHostsToProfiles: @NO, -- kPreferenceKeyCheckForUpdatesAutomatically: @YES, -+ kPreferenceKeyCheckForUpdatesAutomatically: @NO, - kPreferenceKeyCheckForTestReleases: @NO, - kPreferenceKeyLoadPrefsFromCustomFolder: @NO, - kPreferenceKeyNeverRemindPrefsChangesLostForFileHaveSelection: @NO, --- -2.29.2 - diff --git a/aqua/iTerm2/files/patch-remove-sparkle.diff b/aqua/iTerm2/files/patch-remove-sparkle.diff deleted file mode 100644 index 34944b339fe19..0000000000000 --- a/aqua/iTerm2/files/patch-remove-sparkle.diff +++ /dev/null @@ -1,210 +0,0 @@ -From 12ed6ad18ed8e7390b9fa6681487c75a0eb9c979 Mon Sep 17 00:00:00 2001 -From: Andrew Udvare -Date: Fri, 6 Nov 2020 16:40:20 -0500 -Subject: [PATCH] Remove update stuff - ---- - Interfaces/MainMenu.xib | 10 --------- - Interfaces/PreferencePanel.xib | 26 ---------------------- - sources/GeneralPreferencesViewController.m | 16 ------------- - sources/iTermApplicationDelegate.m | 8 ------- - sources/iTermController.m | 2 +- - sources/iTermLaunchExperienceController.m | 2 +- - sources/iTermPreferences.m | 2 +- - 7 files changed, 3 insertions(+), 63 deletions(-) - -diff --git Interfaces/MainMenu.xib Interfaces/MainMenu.xib -index 093a4958c..76521fa89 100644 ---- Interfaces/MainMenu.xib -+++ Interfaces/MainMenu.xib -@@ -28,14 +28,6 @@ - - - -- -- -- -- -- -- -- -- - - - -@@ -1336,7 +1328,6 @@ DQ - - - -- - - - -@@ -1344,7 +1335,6 @@ DQ - - - -- - - - -diff --git Interfaces/PreferencePanel.xib Interfaces/PreferencePanel.xib -index e0df82e16..e9716d6fb 100644 ---- Interfaces/PreferencePanel.xib -+++ Interfaces/PreferencePanel.xib -@@ -1225,8 +1225,6 @@ DQ - - - -- -- - - - -@@ -4705,30 +4703,6 @@ DQ - - - -- -- -- -- -- - -diff --git sources/GeneralPreferencesViewController.m sources/GeneralPreferencesViewController.m -index 572346fd9..0b437dd2f 100644 ---- sources/GeneralPreferencesViewController.m -+++ sources/GeneralPreferencesViewController.m -@@ -64,12 +64,6 @@ enum { - // Enable bonjour - IBOutlet NSButton *_enableBonjour; - -- // Check for updates automatically -- IBOutlet NSButton *_checkUpdate; -- -- // Prompt for test-release updates -- IBOutlet NSButton *_checkTestRelease; -- - // Load prefs from custom folder - IBOutlet NSButton *_loadPrefsFromCustomFolder; // Should load? - IBOutlet NSTextField *_prefsCustomFolder; // Path or URL text field -@@ -304,16 +298,6 @@ enum { - relatedView:nil - type:kPreferenceInfoTypeCheckbox]; - -- [self defineControl:_checkUpdate -- key:kPreferenceKeyCheckForUpdatesAutomatically -- relatedView:nil -- type:kPreferenceInfoTypeCheckbox]; -- -- [self defineControl:_checkTestRelease -- key:kPreferenceKeyCheckForTestReleases -- relatedView:nil -- type:kPreferenceInfoTypeCheckbox]; -- - // --------------------------------------------------------------------------------------------- - info = [self defineControl:_loadPrefsFromCustomFolder - key:kPreferenceKeyLoadPrefsFromCustomFolder -diff --git sources/iTermApplicationDelegate.m sources/iTermApplicationDelegate.m -index 1702d1cb0..20e8949f9 100644 ---- sources/iTermApplicationDelegate.m -+++ sources/iTermApplicationDelegate.m -@@ -182,7 +182,6 @@ static BOOL hasBecomeActive = NO; - IBOutlet NSMenuItem *showFullScreenTabs; - IBOutlet NSMenuItem *useTransparency; - IBOutlet NSMenuItem *maximizePane; -- IBOutlet SUUpdater * suUpdater; - IBOutlet NSMenuItem *_showTipOfTheDay; // Here because we must remove it for older OS versions. - BOOL quittingBecauseLastWindowClosed_; - -@@ -1190,11 +1189,6 @@ static BOOL hasBecomeActive = NO; - - [self updateBuriedSessionsMenu:_statusIconBuriedSessions]; - -- item = [[[NSMenuItem alloc] initWithTitle:@"Check For Updates" -- action:@selector(checkForUpdatesFromMenu:) -- keyEquivalent:@""] autorelease]; -- [menu addItem:item]; -- - item = [[[NSMenuItem alloc] initWithTitle:@"Quit iTerm2" - action:@selector(terminate:) - keyEquivalent:@""] autorelease]; -@@ -1350,7 +1344,6 @@ static BOOL hasBecomeActive = NO; - silenceable:kiTermWarningTypeSilenceableForOneMonth - window:nil]; - if (selection == kiTermWarningSelection1) { -- [[SUUpdater sharedUpdater] checkForUpdates:nil]; - } - } - } -@@ -1473,7 +1466,6 @@ static BOOL hasBecomeActive = NO; - } - - - (IBAction)checkForUpdatesFromMenu:(id)sender { -- [suUpdater checkForUpdates:(sender)]; - } - - #pragma mark - Main Menu -diff --git sources/iTermController.m sources/iTermController.m -index 5054f89d9..a5fef1132 100644 ---- sources/iTermController.m -+++ sources/iTermController.m -@@ -1175,7 +1175,7 @@ static iTermController *gSharedInstance; - } - - - (void)refreshSoftwareUpdateUserDefaults { -- BOOL checkForTestReleases = [iTermPreferences boolForKey:kPreferenceKeyCheckForTestReleases]; -+ BOOL checkForTestReleases = NO; - NSString *appCast = checkForTestReleases ? - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"SUFeedURLForTesting"] : - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"SUFeedURLForFinal"]; -diff --git sources/iTermLaunchExperienceController.m sources/iTermLaunchExperienceController.m -index 2a31322d1..d89935b0c 100644 ---- sources/iTermLaunchExperienceController.m -+++ sources/iTermLaunchExperienceController.m -@@ -110,7 +110,7 @@ typedef NS_ENUM(NSUInteger, iTermLaunchExperienceChoice) { - self = [super init]; - if (self) { - const NSInteger runCount = [iTermLaunchExperienceController incrementRunCount]; -- if (runCount == 2 && ![[SUUpdater sharedUpdater] automaticallyChecksForUpdates]) { -+ if (runCount == 2) { - // Sparkle will do its thing this launch. - _choice = iTermLaunchExperienceChoiceNone; - } else if ([iTermLaunchExperienceController quelled]) { -diff --git sources/iTermPreferences.m sources/iTermPreferences.m -index 04b1fe381..629f2377f 100644 ---- sources/iTermPreferences.m -+++ sources/iTermPreferences.m -@@ -279,7 +279,7 @@ static NSString *sPreviousVersion; - kPreferenceKeyInstantReplayMemoryMegabytes: @4, - kPreferenceKeySavePasteAndCommandHistory: @NO, - kPreferenceKeyAddBonjourHostsToProfiles: @NO, -- kPreferenceKeyCheckForUpdatesAutomatically: @YES, -+ kPreferenceKeyCheckForUpdatesAutomatically: @NO, - kPreferenceKeyCheckForTestReleases: @NO, - kPreferenceKeyLoadPrefsFromCustomFolder: @NO, - kPreferenceKeyNeverRemindPrefsChangesLostForFileHaveSelection: @NO, --- -2.29.2 - diff --git a/aqua/iTerm2/files/patch-xcode12.diff b/aqua/iTerm2/files/patch-xcode12.diff deleted file mode 100644 index a9e275cc3a5b5..0000000000000 --- a/aqua/iTerm2/files/patch-xcode12.diff +++ /dev/null @@ -1,56 +0,0 @@ -commit 79f105b6d09a084bcba92713cb6a1f3f0fc4277d -Author: Michael Klein -Date: Sun Jan 15 12:47:59 2023 +0100 - - Fix XCode 12 compile error - - error: property 'safeAreaInsets' not found on object of type 'NSScreen *' - -diff --git a/sources/NSScreen+iTerm.m b/sources/NSScreen+iTerm.m -index 666abfdd0..ea64a4f22 100644 ---- sources/NSScreen+iTerm.m -+++ sources/NSScreen+iTerm.m -@@ -93,9 +93,11 @@ - } - - - (CGFloat)notchHeight { -+#ifdef MAX_OS_VERSION_12_0 - if (@available(macOS 12.0, *)) { - return self.safeAreaInsets.top; - } -+#endif - return 0; - } - -@@ -107,11 +109,13 @@ - } - - - (CGFloat)it_menuBarHeight { -+#ifdef MAX_OS_VERSION_12_0 - if (@available(macOS 12, *)) { - // When the "current" screen has a notch, there doesn't seem to be a way to get the height - // of the menu bar on other screens :( - return MAX(24, self.safeAreaInsets.top); - } -+#endif - return NSApp.mainMenu.menuBarHeight; - } - -diff --git a/sources/iTermRootTerminalView.m b/sources/iTermRootTerminalView.m -index 618764c38..55285f4fc 100644 ---- sources/iTermRootTerminalView.m -+++ sources/iTermRootTerminalView.m -@@ -1252,11 +1252,13 @@ NS_CLASS_AVAILABLE_MAC(10_14) - if (fakeHeight > 0) { - return fakeHeight; - } -+#ifdef MAC_OS_VERSION_12_0 - if (@available(macOS 12, *)) { - // self.safeAreaInsets is all 0s on a notch Mac. Why the hell doesn't anything work right? - const NSEdgeInsets safeAreaInsets = self.window.screen.safeAreaInsets; - return safeAreaInsets.top; - } -+#endif - return 0; - } -