From 73c1ef2df9a6c8a2837212ecce900794d0f21826 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Fri, 13 Mar 2026 12:43:02 -0700 Subject: [PATCH 1/2] Add onTabCloseRequest hook for explicit tab close gestures Allows the host application to distinguish user-initiated tab closes (clicking the X button) from internal/programmatic closes, so it can decide whether closing the last surface should also close the workspace. Co-Authored-By: Claude Opus 4.6 --- Sources/Bonsplit/Internal/Views/TabBarView.swift | 1 + Sources/Bonsplit/Public/BonsplitController.swift | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Sources/Bonsplit/Internal/Views/TabBarView.swift b/Sources/Bonsplit/Internal/Views/TabBarView.swift index e14b6e96..4f2a5d38 100644 --- a/Sources/Bonsplit/Internal/Views/TabBarView.swift +++ b/Sources/Bonsplit/Internal/Views/TabBarView.swift @@ -249,6 +249,7 @@ struct TabBarView: View { dlog("tab.close pane=\(pane.id.id.uuidString.prefix(5)) tab=\(tab.id.uuidString.prefix(5)) title=\"\(tab.title)\"") #endif withTransaction(Transaction(animation: nil)) { + controller.onTabCloseRequest?(TabID(id: tab.id), pane.id) _ = controller.closeTab(TabID(id: tab.id), inPane: pane.id) } }, diff --git a/Sources/Bonsplit/Public/BonsplitController.swift b/Sources/Bonsplit/Public/BonsplitController.swift index a44f7688..653f19f4 100644 --- a/Sources/Bonsplit/Public/BonsplitController.swift +++ b/Sources/Bonsplit/Public/BonsplitController.swift @@ -51,6 +51,10 @@ public final class BonsplitController { /// Return `true` when the drop has been handled by the host application. @ObservationIgnored public var onExternalTabDrop: ((ExternalTabDropRequest) -> Bool)? + /// Called when the user explicitly requests to close a tab from the tab strip UI. + /// Internal host-driven closes should not use this hook. + @ObservationIgnored public var onTabCloseRequest: ((_ tabId: TabID, _ paneId: PaneID) -> Void)? + // MARK: - Internal State internal var internalController: SplitViewController From ad798c5545155ca23b23b430ded65a0af8b23d93 Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Mon, 16 Mar 2026 14:45:57 -0400 Subject: [PATCH 2/2] feat: double-click pane tab to toggle zoom --- Sources/Bonsplit/Internal/Views/TabItemView.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/Bonsplit/Internal/Views/TabItemView.swift b/Sources/Bonsplit/Internal/Views/TabItemView.swift index bc23a339..60ebfb10 100644 --- a/Sources/Bonsplit/Internal/Views/TabItemView.swift +++ b/Sources/Bonsplit/Internal/Views/TabItemView.swift @@ -181,6 +181,9 @@ struct TabItemView: View { guard !tab.isPinned else { return } onClose() })) + .onTapGesture(count: 2) { + onZoomToggle() + } .onTapGesture { onSelect() }