I’m developing a text editor. In the main pane of a window managed by NSSplitViewController, I place an NSTextView enclosed in an NSScrollView alongside a custom NSView subclass that displays line numbers.
The issue is that the line number view sits outside the scroll view, so it does not participate in the visual effects applied by the title bar or by an NSSplitViewItemAccessoryViewController attached to the parent view controller.
This problem has existed since around macOS 26, but it appears to be more noticeable in macOS 27 Beta 1.
Due to various implementation requirements, my line number view cannot be implemented as a subclass of NSRulerView. In this situation, is there any supported way to ensure that accessory view and toolbar effects are also properly applied to views that are outside the scroll view?
The attached screenshot demonstrates a case where the edge effect is not applied correctly. The line number view on the left side does not participate in the effect and instead appears to visually break through it.
Thanks for the question. I love CotEditor!
As my colleague mentioned, one way to achieve this would be to have the editor scroll view extend the full width of the window, and have the line number view overlap with the editor. In the case of horizontally-scrolling text (line wrapping disabled), you could draw an opaque background on the line number view to avoid line numbers drawing directly on top of the editor’s text. The editor content and scroller insets will have to be adjusted on the leading edge to avoid intersecting with the line number view.
I would also recommend looking into NSScrollView’s addFloatingSubview(_:for:) API so that the line numbers appear just above the scrolling content, but below visual effects.