macOS: reorganize SurfaceView related files - #13764
Open
bo2themax wants to merge 13 commits into
Open
Conversation
bo2themax
force-pushed
the
push-f8d3335c
branch
3 times, most recently
from
August 14, 2026 07:07
92e80ae to
b522496
Compare
Pure file rename. The `_AppKit` suffix dated back to when this file had an iOS counterpart; the surface view is AppKit-only now, so the name just adds noise. Renaming to the `Ghostty.Type.swift` convention used by the rest of the Ghostty sources. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
OSSurfaceView existed as a platform-neutral base class for the iOS port, which never landed. Everything it declared was either overridden by SurfaceView or only meaningful with a live `ghostty_surface_t`, so the base class was an indirection with exactly one subclass: - `surface` returned nil and was overridden to read `surfaceModel`. - `focusDidChange`/`sizeDidChange` were empty placeholders, overridden. - `endSearch` was overridden to move focus before calling `super`. - `progressReport`/`searchState` were plain `@Published` properties that SurfaceView overrode only to attach `didSet` observers. Move the state, the readonly notification observer, `highlight()`, `setChildExitedMessage`, and the nested `SearchState` type into SurfaceView and drop the `override`s. `id` is now assigned directly in SurfaceView's init instead of being threaded through `super.init(id:)`. No behavior change: the readonly observer is registered alongside the other notification observers in the same init, and SurfaceView's `deinit` already removed all observers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
SurfaceView.swift held the top-level SwiftUI view for a surface plus every overlay it composes. Move SurfaceWrapper, and the SurfaceRepresentable it wraps, into SurfaceWrapper.swift so the entry point is findable without scrolling past ten overlay views. SurfaceRepresentable is now `private`: SurfaceWrapper is its only user, so file scope keeps it out of the way of the rest of the module. Pure code motion otherwise. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
SurfaceConfiguration is a model type, not a view, and it was sitting in the middle of SurfaceView.swift between two overlay views. Move it to SurfaceConfiguration.swift alongside the rest of the surface sources. It only needs AppKit, GhosttyKit and System, so the new file imports those rather than SwiftUI. Pure code motion. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
moveFocus pokes at a SurfaceView's window to reset the first responder, so it belongs with the view it manipulates rather than at the bottom of the overlay views file. Pure code motion. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
…ion.swift The SwiftUI environment and focused-value plumbing for surfaces was appended to the bottom of SurfaceView.swift, outside the `extension Ghostty` block it had nothing to do with. Move it to Ghostty/SwiftUI+Extension.swift. Pure code motion; the keys and their definitions are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
The `@Entry` macro generates the key type, the default value and the accessor, so the six hand-written key structs and their get/set pairs collapse to one line each. Behavior is unchanged: every key keeps its type and its `nil` default. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
Pure file rename. What's left in the file after moving SurfaceWrapper, SurfaceConfiguration and the environment keys out is the set of views that decorate a surface: the resize and search overlays, the key state indicator, the bell border, the highlight, the readonly badge and its popover, and the two error views. "SurfaceView.swift" no longer describes that, and it was confusing next to Ghostty.SurfaceView.swift. "Accessory" rather than "Overlay" because the popover and the badge aren't overlays. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
Ghostty.SurfaceView.swift is 2714 lines after absorbing OSSurfaceView. Move the self-contained extensions out into the SurfaceView+Feature.swift convention already used by SurfaceView+Image.swift and SurfaceView+Transferable.swift, starting with the SearchState model and the two search navigation helpers. This also pairs the file with the existing SurfaceView+SearchStateTests.swift. Pure code motion; the only change is dropping the MARK header the file name now carries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
Pure code motion out of Ghostty.SurfaceView.swift; the only change is dropping the MARK header the file name now carries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
Pure code motion out of Ghostty.SurfaceView.swift; the only change is dropping the MARK header the file name now carries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
Pure code motion out of Ghostty.SurfaceView.swift; the only change is dropping the MARK header the file name now carries. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
Pure code motion out of Ghostty.SurfaceView.swift; the only change is dropping the MARK header the file name now carries. The documentation link moves with the extension. NSTextInputClient stays behind: it touches four private members (markedText, keyTextAccumulator, leadSurrogate, committedPreeditTextAction) shared with the key event path in the class body, so moving it would mean widening those to internal. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018gsMAN9qTB7HivpTfkWF47
bo2themax
force-pushed
the
push-f8d3335c
branch
from
August 19, 2026 09:56
b522496 to
5172598
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ghostty.SurfaceView.swift is still a very large file, but we can split it gradually in the future.
AI Disclosure
Claude spliced my local branch to smaller commits and I judged in another session and skimmed myself.