Skip to content

Commit 7118d3b

Browse files
committed
refactor: split TerminalController.swift into domain extension files
TerminalController.swift covered ~10 v2 socket command domains in a single 9,530-line file. Following the precedent of TerminalController+BrowserAutomation.swift, split each command domain's handler bodies (verbatim, no dispatch/behavior changes) into its own extension file: - TerminalController+Window.swift (window.*) - TerminalController+Workspace.swift (workspace.* CRUD/remote/action/tab.action) - TerminalController+Telemetry.swift (off-main-parse + main.async-mutate report_*/ports_kick/set_status/log/progress/sidebar-metadata commands) - TerminalController+Surface.swift (surface.*) - TerminalController+Pane.swift (pane.*) - TerminalController+Notification.swift (notification.*) - TerminalController+System.swift (system.*/settings.*/feedback.*/app.*) - TerminalController+Debug.swift (debug.* plus their private implementation helpers) The dispatch switch, the capabilities array, socket transport/lifecycle/auth, and helpers genuinely shared across 3+ domains (v2Ok/v2Error/v2Ref family, v2UUID/v2String param parsing, v2ResolveTabManager/v2ResolveWorkspace, orderedPanels/parseSplitDirection/readTerminalTextForSnapshot, which are also called from AppDelegate+UITestCmdClick.swift, GhosttyTerminalView+Mouse.swift, and Workspace.swift) stay in the main file, which is now 2,752 lines. Every handler function reachable from the dispatch switch was widened from private to internal (drop-private only, no signature/behavior changes) since the switch — which stays in the main file per the split's constraints — calls them via self. The same widening was applied to a handful of shared low-level helpers/properties now called cross-file: tabManager, socketPath, socketFastPathState, v2TabRef, v2StringArray, v2StringMap, v2ActionKey, v2UUIDAny, v2LocatePane, v2Double, v2IntArray, v2HasNonNullParam, v2StrictInt, v2PanelType, socketCommandAllowsInAppFocusMutations() (instance overload — was shadowed by an internal static overload of the same name once the private one became invisible cross-file), tailTerminalLines, and parseSidebarMetadataFormat. No other code changes. Registered the 8 new files in GhosttyTabs.xcodeproj/project.pbxproj (PBXFileReference + PBXBuildFile + group + Sources build phase entries, IDs prefixed NRTC). Refs #96.
1 parent 50e3eff commit 7118d3b

10 files changed

Lines changed: 7059 additions & 6963 deletions

GhosttyTabs.xcodeproj/project.pbxproj

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
A5001006 /* GhosttyKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5001016 /* GhosttyKit.xcframework */; };
3434
A5001007 /* TerminalController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001019 /* TerminalController.swift */; };
3535
A5FF0014 /* TerminalController+BrowserAutomation.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FF0004 /* TerminalController+BrowserAutomation.swift */; };
36+
NRTC0011 /* TerminalController+System.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRTC0001 /* TerminalController+System.swift */; };
37+
NRTC0012 /* TerminalController+Telemetry.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRTC0002 /* TerminalController+Telemetry.swift */; };
38+
NRTC0013 /* TerminalController+Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRTC0003 /* TerminalController+Window.swift */; };
39+
NRTC0014 /* TerminalController+Workspace.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRTC0004 /* TerminalController+Workspace.swift */; };
40+
NRTC0015 /* TerminalController+Surface.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRTC0005 /* TerminalController+Surface.swift */; };
41+
NRTC0016 /* TerminalController+Pane.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRTC0006 /* TerminalController+Pane.swift */; };
42+
NRTC0017 /* TerminalController+Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRTC0007 /* TerminalController+Notification.swift */; };
43+
NRTC0018 /* TerminalController+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRTC0008 /* TerminalController+Debug.swift */; };
3644
A5001500 /* ProgramaWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001510 /* ProgramaWebView.swift */; };
3745
A5001501 /* UITestRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001511 /* UITestRecorder.swift */; };
3846
A5001226 /* SocketControlSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001225 /* SocketControlSettings.swift */; };
@@ -259,6 +267,14 @@
259267
A5001018 /* programa-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "programa-Bridging-Header.h"; sourceTree = "<group>"; };
260268
A5001019 /* TerminalController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalController.swift; sourceTree = "<group>"; };
261269
A5FF0004 /* TerminalController+BrowserAutomation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+BrowserAutomation.swift"; sourceTree = "<group>"; };
270+
NRTC0001 /* TerminalController+System.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+System.swift"; sourceTree = "<group>"; };
271+
NRTC0002 /* TerminalController+Telemetry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+Telemetry.swift"; sourceTree = "<group>"; };
272+
NRTC0003 /* TerminalController+Window.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+Window.swift"; sourceTree = "<group>"; };
273+
NRTC0004 /* TerminalController+Workspace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+Workspace.swift"; sourceTree = "<group>"; };
274+
NRTC0005 /* TerminalController+Surface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+Surface.swift"; sourceTree = "<group>"; };
275+
NRTC0006 /* TerminalController+Pane.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+Pane.swift"; sourceTree = "<group>"; };
276+
NRTC0007 /* TerminalController+Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+Notification.swift"; sourceTree = "<group>"; };
277+
NRTC0008 /* TerminalController+Debug.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TerminalController+Debug.swift"; sourceTree = "<group>"; };
262278
A5001620 /* AppleScriptSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleScriptSupport.swift; sourceTree = "<group>"; };
263279
D1320AA0D1320AA0D1320AA4 /* AppIconDockTilePlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIconDockTilePlugin.swift; sourceTree = "<group>"; };
264280
A5001510 /* ProgramaWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Panels/ProgramaWebView.swift; sourceTree = "<group>"; };
@@ -531,6 +547,14 @@
531547
A5FF0018 /* HostedViewPortalRegistry.swift */,
532548
A5001019 /* TerminalController.swift */,
533549
A5FF0004 /* TerminalController+BrowserAutomation.swift */,
550+
NRTC0001 /* TerminalController+System.swift */,
551+
NRTC0002 /* TerminalController+Telemetry.swift */,
552+
NRTC0003 /* TerminalController+Window.swift */,
553+
NRTC0004 /* TerminalController+Workspace.swift */,
554+
NRTC0005 /* TerminalController+Surface.swift */,
555+
NRTC0006 /* TerminalController+Pane.swift */,
556+
NRTC0007 /* TerminalController+Notification.swift */,
557+
NRTC0008 /* TerminalController+Debug.swift */,
534558
A5001541 /* PortScanner.swift */,
535559
A5001544 /* TerminalImageTransfer.swift */,
536560
A5001545 /* TerminalSSHSessionDetector.swift */,
@@ -861,6 +885,14 @@
861885
A5FF0008 /* HostedViewPortalRegistry.swift in Sources */,
862886
A5001007 /* TerminalController.swift in Sources */,
863887
A5FF0014 /* TerminalController+BrowserAutomation.swift in Sources */,
888+
NRTC0011 /* TerminalController+System.swift in Sources */,
889+
NRTC0012 /* TerminalController+Telemetry.swift in Sources */,
890+
NRTC0013 /* TerminalController+Window.swift in Sources */,
891+
NRTC0014 /* TerminalController+Workspace.swift in Sources */,
892+
NRTC0015 /* TerminalController+Surface.swift in Sources */,
893+
NRTC0016 /* TerminalController+Pane.swift in Sources */,
894+
NRTC0017 /* TerminalController+Notification.swift in Sources */,
895+
NRTC0018 /* TerminalController+Debug.swift in Sources */,
864896
A5001540 /* PortScanner.swift in Sources */,
865897
A5001542 /* TerminalImageTransfer.swift in Sources */,
866898
A5001543 /* TerminalSSHSessionDetector.swift in Sources */,

0 commit comments

Comments
 (0)