apprt/embedded: close surface callback

This commit is contained in:
Mitchell Hashimoto
2023-03-08 15:05:15 -08:00
parent fa9ee0815f
commit 6c857877e8
8 changed files with 46 additions and 5 deletions

View File

@@ -143,15 +143,23 @@ extension Ghostty {
.onReceive(pub) { onNewSplit(notification: $0) }
case .horizontal:
SplitView(.horizontal, left: {
let pub = NotificationCenter.default.publisher(for: Ghostty.Notification.ghosttyCloseSurface, object: state.topLeft)
TerminalSplitChild(app, topLeft: state.topLeft)
.onReceive(pub) { _ in closeTopLeft() }
}, right: {
let pub = NotificationCenter.default.publisher(for: Ghostty.Notification.ghosttyCloseSurface, object: state.bottomRight!)
TerminalSplitChild(app, topLeft: state.bottomRight!)
.onReceive(pub) { _ in closeBottomRight() }
})
case .vertical:
SplitView(.vertical, left: {
let pub = NotificationCenter.default.publisher(for: Ghostty.Notification.ghosttyCloseSurface, object: state.topLeft)
TerminalSplitChild(app, topLeft: state.topLeft)
.onReceive(pub) { _ in closeTopLeft() }
}, right: {
let pub = NotificationCenter.default.publisher(for: Ghostty.Notification.ghosttyCloseSurface, object: state.bottomRight!)
TerminalSplitChild(app, topLeft: state.bottomRight!)
.onReceive(pub) { _ in closeBottomRight() }
})
}
}