From 7dcfebcd5d99fe76c5d861e2c30ba4eb92f16fd5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 4 Jun 2025 09:28:18 -0700 Subject: [PATCH] macos: isSplit guarding on focus split directions works --- macos/Sources/Features/Splits/SplitTree.swift | 7 ++++++- macos/Sources/Ghostty/Ghostty.App.swift | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/macos/Sources/Features/Splits/SplitTree.swift b/macos/Sources/Features/Splits/SplitTree.swift index a093934d8..c3a4e3097 100644 --- a/macos/Sources/Features/Splits/SplitTree.swift +++ b/macos/Sources/Features/Splits/SplitTree.swift @@ -72,7 +72,12 @@ extension SplitTree { var isEmpty: Bool { root == nil } - + + /// Returns true if this tree is split. + var isSplit: Bool { + if case .split = root { true } else { false } + } + init() { self.init(root: nil, zoomed: nil) } diff --git a/macos/Sources/Ghostty/Ghostty.App.swift b/macos/Sources/Ghostty/Ghostty.App.swift index 95e04fc1e..08c284b04 100644 --- a/macos/Sources/Ghostty/Ghostty.App.swift +++ b/macos/Sources/Ghostty/Ghostty.App.swift @@ -921,8 +921,7 @@ extension Ghostty { // we should only be returning true if we actually performed the action, // but this handles the most common case of caring about goto_split performability // which is the no-split case. - // TODO: fix this - //guard controller.surfaceTree?.isSplit ?? false else { return false } + guard controller.surfaceTree2.isSplit else { return false } NotificationCenter.default.post( name: Notification.ghosttyFocusSplit,