@@ -47,7 +47,9 @@ - (NSRect)adjustScroll:(NSRect)proposedVisibleRect {
4747@end
4848
4949@interface LynxtronScintillaView : ScintillaView
50+ @property (nonatomic , strong ) NSView * scrollerCornerFillView;
5051- (void )syncBounceBackgroundWithStyleDefault ;
52+ - (void )updateScrollerCornerFillFrame ;
5153@end
5254
5355@implementation LynxtronScintillaView
@@ -56,6 +58,30 @@ + (Class)contentViewClass {
5658 return [LynxtronSCIContentView class ];
5759}
5860
61+ - (void )layout {
62+ [super layout ];
63+ [self updateScrollerCornerFillFrame ];
64+ }
65+
66+ - (void )updateScrollerCornerFillFrame {
67+ NSScroller * horizontalScroller = self.scrollView .horizontalScroller ;
68+ NSScroller * verticalScroller = self.scrollView .verticalScroller ;
69+ const BOOL visible = self.scrollView .hasHorizontalScroller &&
70+ self.scrollView .hasVerticalScroller &&
71+ horizontalScroller != nil &&
72+ verticalScroller != nil ;
73+ self.scrollerCornerFillView .hidden = !visible;
74+ if (!visible) return ;
75+
76+ // NSScrollView leaves this rectangle uncovered when both legacy scrollers
77+ // are present. Pin our fill view to the same bottom-right intersection.
78+ self.scrollerCornerFillView .frame = NSMakeRect (
79+ NSMinX (verticalScroller.frame),
80+ NSMinY(horizontalScroller.frame),
81+ NSWidth(verticalScroller.frame),
82+ NSHeight(horizontalScroller.frame));
83+ }
84+
5985- (void )syncBounceBackgroundWithStyleDefault {
6086 // Scintilla paints the document itself, but elastic overscroll exposes
6187 // AppKit's scroll/clip view background. Derive that native background
@@ -70,6 +96,20 @@ - (void)syncBounceBackgroundWithStyleDefault {
7096 self.scrollView .backgroundColor = backgroundColor;
7197 self.scrollView .contentView .drawsBackground = YES ;
7298 self.scrollView .contentView .backgroundColor = backgroundColor;
99+
100+ // AppKit leaves a separate rectangle where the horizontal and vertical
101+ // legacy scrollers meet. Its default fill stays white in a dark editor.
102+ if (self.scrollerCornerFillView == nil ) {
103+ self.scrollerCornerFillView = [[NSView alloc ] initWithFrame: NSZeroRect ];
104+ self.scrollerCornerFillView .autoresizingMask =
105+ NSViewMinXMargin | NSViewMaxYMargin;
106+ [self .scrollView addSubview: self .scrollerCornerFillView];
107+ }
108+ if (self.scrollerCornerFillView != nil ) {
109+ self.scrollerCornerFillView .wantsLayer = YES ;
110+ self.scrollerCornerFillView .layer .backgroundColor = backgroundColor.CGColor ;
111+ [self updateScrollerCornerFillFrame ];
112+ }
73113}
74114
75115@end
@@ -98,6 +138,14 @@ - (instancetype)initWithFrame:(NSRect)frameRect owner:(extension::ScintillaView*
98138 _owner = owner;
99139 _scintillaView = [[LynxtronScintillaView alloc ] initWithFrame: self .bounds];
100140 [_scintillaView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
141+ // During a live mosaic resize AppKit can leave the scroll view's
142+ // private content-background view one legacy-scroller (17pt) larger
143+ // than the scroll view itself. NSView does not clip subviews by
144+ // default, so that private background otherwise paints across the
145+ // neighbouring pane's toolbar. Keep every AppKit-owned scroll-view
146+ // child contained by the editor's native bounds.
147+ _scintillaView.scrollView .wantsLayer = YES ;
148+ _scintillaView.scrollView .layer .masksToBounds = YES ;
101149 _scintillaView.delegate = self; // receive SCN_MODIFIED etc.
102150 [self addSubview: _scintillaView];
103151 }
0 commit comments