Skip to content

Commit c286866

Browse files
committed
Made editor separators thicker by conditionally adding separators to editors depending on its position in the split layout.
1 parent 41b590d commit c286866

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

CodeEdit/Features/Editor/Views/EditorLayoutView.swift

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ struct EditorLayoutView: View {
4848

4949
struct SubEditorLayoutView: View {
5050
@ObservedObject var data: SplitViewData
51-
5251
@FocusState.Binding var focus: Editor?
5352

5453
var body: some View {
@@ -58,15 +57,33 @@ struct EditorLayoutView: View {
5857
.edgesIgnoringSafeArea([.top, .bottom])
5958
}
6059

61-
var splitView: some View {
62-
ForEach(Array(data.editorLayouts.enumerated()), id: \.offset) { index, item in
60+
func stackContentsView(index: Int, item: EditorLayout) -> some View {
61+
Group {
62+
// Add a divider before the editor if it's not the first
63+
if index != 0 { PanelDivider() }
6364
EditorLayoutView(layout: item, focus: $focus)
6465
.transformEnvironment(\.isAtEdge) { belowToolbar in
6566
calcIsAtEdge(current: &belowToolbar, index: index)
6667
}
6768
.environment(\.splitEditor) { [weak data] edge, newEditor in
6869
data?.split(edge, at: index, new: newEditor)
6970
}
71+
// Add a divider after the editor if it's not the last
72+
if index != data.editorLayouts.count - 1 { PanelDivider() }
73+
}
74+
}
75+
76+
var splitView: some View {
77+
ForEach(Array(data.editorLayouts.enumerated()), id: \.offset) { index, item in
78+
if data.axis == .horizontal {
79+
HStack(spacing: 0) {
80+
stackContentsView(index: index, item: item)
81+
}
82+
} else {
83+
VStack(spacing: 0) {
84+
stackContentsView(index: index, item: item)
85+
}
86+
}
7087
}
7188
}
7289

0 commit comments

Comments
 (0)