diff options
| -rw-r--r-- | cocoa/ScintillaView.h | 7 | ||||
| -rw-r--r-- | cocoa/ScintillaView.mm | 25 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | 
3 files changed, 35 insertions, 1 deletions
| diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index dc5dc030a..8bf10c8e4 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -43,6 +43,13 @@ extern NSString *const SCIUpdateUINotification;  @end  /** + * SCIScrollView provides pre-macOS 10.14 tiling behavior. + */ +@interface SCIScrollView : NSScrollView; + +@end + +/**   * SCIMarginView draws line numbers and other margins next to the text view.   */  @interface SCIMarginView : NSRulerView; 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]; diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index bf58633c6..b84fc1f3d 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -604,6 +604,10 @@  	Notify with SC_UPDATE_SELECTION when user performs a multiple selection add.  	</li>  	<li> +	On macOS 10.14 Cocoa, fix incorrect horizontal offset. +	<a href="https://sourceforge.net/p/scintilla/bugs/2022/">Bug #2022</a>. +	</li> +	<li>  	On Cocoa, fix a crash that occurred when entering a dead key diacritic then a character  	that can not take that diacritic, such as option+e (acute accent) followed by g.  	<a href="https://sourceforge.net/p/scintilla/bugs/2061/">Bug #2061</a>. | 
