From f614d45e28f18738620e4fc369ad3b65302fe833 Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Sun, 5 Nov 2023 19:36:36 -0600 Subject: [PATCH] macos: set id on nested terminal splits This fixes https://github.com/mitchellh/ghostty/issues/761 for terminal splits that are not at the root. --- .../Ghostty/Ghostty.TerminalSplit.swift | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/macos/Sources/Ghostty/Ghostty.TerminalSplit.swift b/macos/Sources/Ghostty/Ghostty.TerminalSplit.swift index 2ca66f6d9..82cbd3a04 100644 --- a/macos/Sources/Ghostty/Ghostty.TerminalSplit.swift +++ b/macos/Sources/Ghostty/Ghostty.TerminalSplit.swift @@ -345,33 +345,36 @@ extension Ghostty { let neighbors: SplitNode.Neighbors var body: some View { - switch (node) { - case nil: - Color(.clear) - - case .noSplit(let leaf): - TerminalSplitLeaf( - leaf: leaf, - neighbors: neighbors, - node: $node - ) + Group { + switch (node) { + case nil: + Color(.clear) - case .horizontal(let container): - TerminalSplitContainer( - direction: .horizontal, - neighbors: neighbors, - node: $node, - container: container - ) + case .noSplit(let leaf): + TerminalSplitLeaf( + leaf: leaf, + neighbors: neighbors, + node: $node + ) - case .vertical(let container): - TerminalSplitContainer( - direction: .vertical, - neighbors: neighbors, - node: $node, - container: container - ) + case .horizontal(let container): + TerminalSplitContainer( + direction: .horizontal, + neighbors: neighbors, + node: $node, + container: container + ) + + case .vertical(let container): + TerminalSplitContainer( + direction: .vertical, + neighbors: neighbors, + node: $node, + container: container + ) + } } + .id(node) } }