Skip to content

Commit 06d3082

Browse files
committed
Adjust Padding, Draw Split Edges Only in safe Area
1 parent f86dd7e commit 06d3082

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

CodeEdit/Features/Editor/Views/EditorAreaView.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ struct EditorAreaView: View {
3030
@Environment(\.window.value)
3131
private var window: NSWindow?
3232

33+
@Environment(\.isEditorLayoutAtEdge)
34+
private var isAtEdge
35+
3336
init(editor: Editor, focus: FocusState<Editor?>.Binding) {
3437
self.editor = editor
3538
self._focus = focus
@@ -101,6 +104,10 @@ struct EditorAreaView: View {
101104
}
102105

103106
VStack(spacing: 0) {
107+
if isAtEdge != .top, #available(macOS 26, *) {
108+
Spacer().frame(height: 4)
109+
}
110+
104111
if topSafeArea > 0 {
105112
Rectangle()
106113
.fill(.clear)
@@ -167,7 +174,6 @@ struct EditorAreaView: View {
167174
// )
168175
// ```
169176
// When we can figure out how to disable the 'not focused' glass effect.
170-
171177
$0.background(EffectView(.headerView).ignoresSafeArea(.all))
172178
} else: {
173179
$0.background(EffectView(.headerView))

CodeEdit/Features/Editor/Views/EditorLayoutView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct EditorLayoutView: View {
1515
@Environment(\.window.value)
1616
private var window
1717

18-
@Environment(\.isAtEdge)
18+
@Environment(\.isEditorLayoutAtEdge)
1919
private var isAtEdge
2020

2121
var toolbarHeight: CGFloat {
@@ -63,7 +63,7 @@ struct EditorLayoutView: View {
6363
var splitView: some View {
6464
ForEach(Array(data.editorLayouts.enumerated()), id: \.offset) { index, item in
6565
EditorLayoutView(layout: item, focus: $focus)
66-
.transformEnvironment(\.isAtEdge) { belowToolbar in
66+
.transformEnvironment(\.isEditorLayoutAtEdge) { belowToolbar in
6767
calcIsAtEdge(current: &belowToolbar, index: index)
6868
}
6969
.environment(\.splitEditor) { [weak data] edge, newEditor in
@@ -87,12 +87,12 @@ struct EditorLayoutView: View {
8787
}
8888
}
8989

90-
private struct BelowToolbarEnvironmentKey: EnvironmentKey {
90+
struct BelowToolbarEnvironmentKey: EnvironmentKey {
9191
static var defaultValue: VerticalEdge.Set = .all
9292
}
9393

9494
extension EnvironmentValues {
95-
fileprivate var isAtEdge: BelowToolbarEnvironmentKey.Value {
95+
var isEditorLayoutAtEdge: BelowToolbarEnvironmentKey.Value {
9696
get { self[BelowToolbarEnvironmentKey.self] }
9797
set { self[BelowToolbarEnvironmentKey.self] = newValue }
9898
}

CodeEdit/Features/SplitView/Views/SplitViewControllerView.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ final class SplitViewController: NSSplitViewController {
9696
override var dividerThickness: CGFloat {
9797
customDividerStyle.customThickness ?? super.dividerThickness
9898
}
99+
100+
override func drawDivider(in rect: NSRect) {
101+
let safeRect = NSRect(
102+
x: rect.origin.x,
103+
y: max(rect.origin.y, safeAreaRect.origin.y),
104+
width: isVertical ? dividerThickness : rect.width,
105+
height: isVertical ? safeAreaRect.height : dividerThickness
106+
)
107+
super.drawDivider(in: safeRect)
108+
}
99109
}
100110

101111
var items: [SplitViewItem] = []

0 commit comments

Comments
 (0)