macos: use my new split view

This commit is contained in:
Mitchell Hashimoto
2023-03-07 16:51:26 -08:00
parent 06d770fefa
commit 4bbb419cb0
3 changed files with 10 additions and 15 deletions

View File

@ -108,12 +108,13 @@ extension Ghostty {
Button("Close Right") { closeBottomRight() }
}
HSplitView {
SplitView(.horizontal, left: {
SplitViewChild(app, topLeft: state.topLeft)
.focused($focusedSide, equals: .TopLeft)
}, right: {
SplitViewChild(app, topLeft: state.bottomRight!)
.focused($focusedSide, equals: .BottomRight)
}
})
}
case .vertical:
VStack {
@ -122,12 +123,13 @@ extension Ghostty {
Button("Close Bottom") { closeBottomRight() }
}
VSplitView {
SplitView(.vertical, left: {
SplitViewChild(app, topLeft: state.topLeft)
.focused($focusedSide, equals: .TopLeft)
}, right: {
SplitViewChild(app, topLeft: state.bottomRight!)
.focused($focusedSide, equals: .BottomRight)
}
})
}
}
}

View File

@ -21,15 +21,8 @@ struct GhosttyApp: App {
case .error:
ErrorView()
case .ready:
SplitView(.vertical, left: {
Color.green
}, right: {
Color.red
})
/*
Ghostty.Terminal()
.ghosttyApp(ghostty.app!)
*/
Ghostty.TerminalSplitView()
.ghosttyApp(ghostty.app!)
}
}.commands {
CommandGroup(after: .newItem) {

View File

@ -5,8 +5,8 @@ struct SplitView<L: View, R: View>: View {
let left: L
let right: R
private let splitterVisibleSize: CGFloat = 2
private let splitterInvisibleSize: CGFloat = 5
private let splitterVisibleSize: CGFloat = 1
private let splitterInvisibleSize: CGFloat = 6
@State var split: CGFloat = 0.5