Skip to content

Commit 0d6e802

Browse files
committed
refactor(workspace): extract Persistence/Layout/Bonsplit from Workspace.swift
Workspace.swift (7430 lines) held the Workspace class plus several already-separate top-level extension blocks. Extracted three of those existing seams into their own files, moving content verbatim: - Workspace+Persistence.swift: session snapshot/restore (sessionSnapshot, restoreSessionSnapshot, and their layout/panel helpers) -- was a standalone `extension Workspace { ... }` block. - Workspace+Layout.swift: programa.json custom layout application (applyCustomLayout and its tree/pane helpers) -- was a standalone `extension Workspace { ... }` block. - Workspace+Bonsplit.swift: the `extension Workspace: BonsplitDelegate` conformance. Workspace.swift drops from 7430 to 5626 lines; it now holds the class declaration, its nested types, stored properties, and the methods that don't yet have a dedicated extension file. Access-level widening (required for cross-file visibility, since Swift's `private` is file-scoped even across extensions of the same type): - Blanket: every direct member of `final class Workspace` (nested types, stored properties, methods) was widened from `private` to the Swift default `internal`, mirroring the same treatment already applied to WorkspaceRemoteSessionController -- the class's entire private surface needed it to support extraction, so this was done as one mechanical pass rather than itemized per-symbol. - Individually noted, since they were outside that blanket sweep: - `SessionPaneRestoreEntry` (a private top-level struct, not a class member) -- used by the extracted persistence helpers. - `panels`, `panelCustomTitles`, `pinnedPanelIds`, `manualUnreadPanelIds`, `tmuxLayoutSnapshot` -- `private(set)` published properties whose setters are called from Workspace+Bonsplit.swift; widened to plain internal-settable `@Published var`. - `manualUnreadClearDelayAfterFocusFlash` -- a `nonisolated private static let` read from Workspace+Bonsplit.swift. - `applyTabSelection`, `beginNonFocusSplitFocusReassert`, `clearNonFocusSplitFocusReassert`, `markExplicitFocusIntent`, `matchesPendingNonFocusSplitFocusReassert` -- private methods declared inside the BonsplitDelegate extension itself but called from the remaining Workspace.swift class body. Verified behavior-identical by a non-blank-line multiset diff between the pre-split file and the four post-split files (normalizing only the access-modifier changes above); the only remaining differences were the added file-header comments, the per-file import blocks every new Swift file needs, and two now-dangling "// MARK:" section comments that were dropped since the content they marked moved to dedicated files. project.pbxproj updated: three new files registered (main app target only). The remaining seams called out in #98 for Workspace.swift -- theming, remote-connection glue, surface creation, and focus/geometry -- are not yet extracted; they live inside the still-5626-line class body rather than as pre-existing standalone extension blocks, so pulling them out safely needs the same per-symbol cross-reference verification done here, at a larger scale. Left for a follow-up pass; noted in issuesPartial. Refs #98.
1 parent 593ea63 commit 0d6e802

5 files changed

Lines changed: 6265 additions & 6224 deletions

File tree

GhosttyTabs.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
A5001290 /* MarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = A5001291 /* MarkdownUI */; };
5353
A5001405 /* PanelContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001415 /* PanelContentView.swift */; };
5454
A5001406 /* Workspace.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001416 /* Workspace.swift */; };
55+
NRWS00000000000000000028 /* Workspace+Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRWS00000000000000000027 /* Workspace+Persistence.swift */; };
56+
NRWS00000000000000000030 /* Workspace+Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRWS00000000000000000029 /* Workspace+Layout.swift */; };
57+
NRWS00000000000000000032 /* Workspace+Bonsplit.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRWS00000000000000000031 /* Workspace+Bonsplit.swift */; };
5558
A5FF0012 /* WorkspaceRemoteSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FF0002 /* WorkspaceRemoteSession.swift */; };
5659
NRWS00000000000000000018 /* WorkspaceRemoteSessionController+ConnectionOrchestration.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRWS00000000000000000017 /* WorkspaceRemoteSessionController+ConnectionOrchestration.swift */; };
5760
NRWS00000000000000000020 /* WorkspaceRemoteSessionController+ProcessExecution.swift in Sources */ = {isa = PBXBuildFile; fileRef = NRWS00000000000000000019 /* WorkspaceRemoteSessionController+ProcessExecution.swift */; };
@@ -288,6 +291,9 @@
288291
A5001418 /* MarkdownPanel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Panels/MarkdownPanel.swift; sourceTree = "<group>"; };
289292
A5001419 /* MarkdownPanelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Panels/MarkdownPanelView.swift; sourceTree = "<group>"; };
290293
A5001416 /* Workspace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Workspace.swift; sourceTree = "<group>"; };
294+
NRWS00000000000000000027 /* Workspace+Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+Persistence.swift"; sourceTree = "<group>"; };
295+
NRWS00000000000000000029 /* Workspace+Layout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+Layout.swift"; sourceTree = "<group>"; };
296+
NRWS00000000000000000031 /* Workspace+Bonsplit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+Bonsplit.swift"; sourceTree = "<group>"; };
291297
A5FF0002 /* WorkspaceRemoteSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkspaceRemoteSession.swift; sourceTree = "<group>"; };
292298
NRWS00000000000000000017 /* WorkspaceRemoteSessionController+ConnectionOrchestration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WorkspaceRemoteSessionController+ConnectionOrchestration.swift"; sourceTree = "<group>"; };
293299
NRWS00000000000000000019 /* WorkspaceRemoteSessionController+ProcessExecution.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WorkspaceRemoteSessionController+ProcessExecution.swift"; sourceTree = "<group>"; };
@@ -541,6 +547,9 @@
541547
A5FF0061 /* TabManager+GitMetadataPolling.swift */,
542548
A5001511 /* UITestRecorder.swift */,
543549
A5001416 /* Workspace.swift */,
550+
NRWS00000000000000000027 /* Workspace+Persistence.swift */,
551+
NRWS00000000000000000029 /* Workspace+Layout.swift */,
552+
NRWS00000000000000000031 /* Workspace+Bonsplit.swift */,
544553
A5FF0002 /* WorkspaceRemoteSession.swift */,
545554
NRWS00000000000000000017 /* WorkspaceRemoteSessionController+ConnectionOrchestration.swift */,
546555
NRWS00000000000000000019 /* WorkspaceRemoteSessionController+ProcessExecution.swift */,
@@ -883,6 +892,9 @@
883892
A5FF0071 /* TabManager+GitMetadataPolling.swift in Sources */,
884893
A5001501 /* UITestRecorder.swift in Sources */,
885894
A5001406 /* Workspace.swift in Sources */,
895+
NRWS00000000000000000028 /* Workspace+Persistence.swift in Sources */,
896+
NRWS00000000000000000030 /* Workspace+Layout.swift in Sources */,
897+
NRWS00000000000000000032 /* Workspace+Bonsplit.swift in Sources */,
886898
A5FF0012 /* WorkspaceRemoteSession.swift in Sources */,
887899
NRWS00000000000000000018 /* WorkspaceRemoteSessionController+ConnectionOrchestration.swift in Sources */,
888900
NRWS00000000000000000020 /* WorkspaceRemoteSessionController+ProcessExecution.swift in Sources */,

0 commit comments

Comments
 (0)