Skip to content

Commit

Permalink
Fill split view background so avoid window glitch
Browse files Browse the repository at this point in the history
When scrolling too fast the left scroll view might be a little
smaller than the split view's immediate content view (which is
a custom NSView) due to syntax highlighter-triggered resizing,
resulting a gutter at the bottom of the document. Worked around
by painting the split view with editor background (so that the
gutter is not visible).
  • Loading branch information
uranusjr committed Aug 20, 2014
1 parent 529721e commit 72fa298
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions MacDown/Code/Document/MPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -1288,12 +1288,17 @@ - (void)setupEditor
[self.editor setValue:value forKey:key];
}

CGColorRef backgroundCGColor = self.editor.backgroundColor.CGColor;
NSView *editorChrome = self.editor.enclosingScrollView.superview;

CALayer *layer = [CALayer layer];
layer.backgroundColor = self.editor.backgroundColor.CGColor;
editorChrome.wantsLayer = YES;
layer.backgroundColor = backgroundCGColor;
editorChrome.layer = layer;

layer = [CALayer layer];
layer.backgroundColor = backgroundCGColor;
self.splitView.layer = layer;

[self.highlighter activate];
}

Expand Down
2 changes: 1 addition & 1 deletion MacDown/Localization/Base.lproj/MPDocument.xib
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5HT-Up-YAd">
<rect key="frame" x="0.0" y="0.0" width="509" height="578"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" copiesOnScroll="NO" id="5eJ-HC-3WM">
<clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="5eJ-HC-3WM">
<rect key="frame" x="0.0" y="0.0" width="509" height="578"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
Expand Down

0 comments on commit 72fa298

Please sign in to comment.