Commit 0d6e802
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
- Sources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
288 | 291 | | |
289 | 292 | | |
290 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
291 | 297 | | |
292 | 298 | | |
293 | 299 | | |
| |||
541 | 547 | | |
542 | 548 | | |
543 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
544 | 553 | | |
545 | 554 | | |
546 | 555 | | |
| |||
883 | 892 | | |
884 | 893 | | |
885 | 894 | | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
886 | 898 | | |
887 | 899 | | |
888 | 900 | | |
| |||
0 commit comments