aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/ScintillaView.mm
diff options
context:
space:
mode:
authorChinh Nguyen <unknown>2019-01-06 09:52:38 +1100
committerChinh Nguyen <unknown>2019-01-06 09:52:38 +1100
commit2e794b1ef52cb04e93f65906a266095bc8eae4f6 (patch)
tree9d4cd00f6319eec0dd38c7e0f9d5d78b1784d896 /cocoa/ScintillaView.mm
parentc3caf294be67a3de63c607689f28cbc390900754 (diff)
downloadscintilla-mirror-2e794b1ef52cb04e93f65906a266095bc8eae4f6.tar.gz
Bug [#2022]. Fix incorrect horizontal offset on macOS 10.14 Mojave.
Diffstat (limited to 'cocoa/ScintillaView.mm')
-rw-r--r--cocoa/ScintillaView.mm25
1 files changed, 24 insertions, 1 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index 05fdf5984..b32c549b1 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -53,6 +53,21 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
}
}
+@implementation SCIScrollView
+- (void) tile {
+ [super tile];
+
+#if defined(MAC_OS_X_VERSION_10_14)
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13) {
+ NSRect frame = self.contentView.frame;
+ frame.origin.x = self.verticalRulerView.requiredThickness;
+ frame.size.width -= frame.origin.x;
+ self.contentView.frame = frame;
+ }
+#endif
+}
+@end
+
// Add marginWidth and owner properties as a private category.
@interface SCIMarginView()
@property(assign) int marginWidth;
@@ -1379,7 +1394,15 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) {
// Pick an arbitrary size, just to make NSScroller selecting the proper scroller direction
// (horizontal or vertical).
NSRect scrollerRect = NSMakeRect(0, 0, 100, 10);
- scrollView = [[NSScrollView alloc] initWithFrame: scrollerRect];
+ scrollView = (NSScrollView *)[[SCIScrollView alloc] initWithFrame: scrollerRect];
+#if defined(MAC_OS_X_VERSION_10_14)
+ // Let SCIScrollView account for other subviews such as vertical ruler by turning off
+ // automaticallyAdjustsContentInsets.
+ if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_13) {
+ scrollView.contentView.automaticallyAdjustsContentInsets = NO;
+ scrollView.contentView.contentInsets = NSEdgeInsetsMake(0., 0., 0., 0.);
+ }
+#endif
scrollView.documentView = mContent;
[scrollView setHasVerticalScroller: YES];
[scrollView setHasHorizontalScroller: YES];