Skip to content

Commit 78984c1

Browse files
committed
Re-fix navigator width bug
1 parent eaa3de7 commit 78984c1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

CodeEdit/Features/Documents/Controllers/CodeEditSplitViewController.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ final class CodeEditSplitViewController: NSSplitViewController {
1919
private weak var windowRef: NSWindow?
2020
private unowned var hapticPerformer: NSHapticFeedbackPerformer
2121

22+
private weak var navigatorItem: NSSplitViewItem?
23+
2224
// MARK: - Initialization
2325

2426
init(
@@ -66,6 +68,7 @@ final class CodeEditSplitViewController: NSSplitViewController {
6668
.environmentObject(editorManager)
6769
})
6870

71+
self.navigatorItem = navigator
6972
addSplitViewItem(navigator)
7073

7174
let workspaceView = SettingsInjector {
@@ -120,6 +123,7 @@ final class CodeEditSplitViewController: NSSplitViewController {
120123
super.viewWillAppear()
121124

122125
guard let workspace else { return }
126+
workspace.notificationPanel.updateToolbarItem()
123127

124128
let navigatorWidth = workspace.getFromWorkspaceState(.splitViewWidth) as? CGFloat
125129
splitView.setPosition(navigatorWidth ?? Self.minSidebarWidth, ofDividerAt: 0)
@@ -135,8 +139,6 @@ final class CodeEditSplitViewController: NSSplitViewController {
135139
.inspectorCollapsed
136140
) as? Bool ?? true
137141
}
138-
139-
workspace.notificationPanel.updateToolbarItem()
140142
}
141143

142144
// MARK: - NSSplitViewDelegate
@@ -200,8 +202,14 @@ final class CodeEditSplitViewController: NSSplitViewController {
200202
}
201203

202204
if resizedDivider == 0 {
203-
let panel = splitView.subviews[0]
204-
let width = panel.frame.size.width
205+
let width: CGFloat
206+
if #available(macOS 26, *) {
207+
let panel = splitViewItems[0]
208+
width = panel.viewController.view.frame.size.width
209+
} else {
210+
let panel = splitView.subviews[0]
211+
width = panel.frame.size.width
212+
}
205213
if width > 0 {
206214
workspace?.addToWorkspaceState(key: .splitViewWidth, value: width)
207215
}

0 commit comments

Comments
 (0)