@@ -78,26 +78,11 @@ - (void)updateMiniMapTextView:(NSTextView*)textView withAttributedString:(NSAttr
7878 [mutableAttributedString enumerateAttributesInRange: NSMakeRange (0 , mutableAttributedString.length) options: NSAttributedStringEnumerationReverse usingBlock:
7979 ^(NSDictionary *attributes, NSRange range, BOOL *stop) {
8080
81- NSMutableParagraphStyle *newParagraphStyle = [[attributes objectForKey: NSParagraphStyleAttributeName ] mutableCopy ];
82- newParagraphStyle.minimumLineHeight *= kDefaultZoomLevel ;
83- newParagraphStyle.maximumLineHeight *= kDefaultZoomLevel ;
84- newParagraphStyle.paragraphSpacing *= kDefaultZoomLevel ;
85- newParagraphStyle.paragraphSpacingBefore *= kDefaultZoomLevel ;
86- newParagraphStyle.firstLineHeadIndent *= kDefaultZoomLevel ;
87- newParagraphStyle.headIndent *= kDefaultZoomLevel ;
88- newParagraphStyle.tailIndent *= kDefaultZoomLevel ;
89- newParagraphStyle.tighteningFactorForTruncation *= kDefaultZoomLevel ;
90-
9181 NSFont *font = [attributes objectForKey: NSFontAttributeName ];
9282 NSFont *newFont = [NSFont fontWithName: font.familyName size: font.pointSize * kDefaultZoomLevel ];
9383
94- NSObject *DVTFontAndColorTheme = [NSClassFromString (@" DVTFontAndColorTheme" ) performSelector: @selector (currentTheme )];
95- NSColor *textColor = [DVTFontAndColorTheme performSelector: @selector (sourcePlainTextColor )];
96-
9784 NSMutableDictionary *mutableAttributes = [NSMutableDictionary dictionaryWithDictionary: attributes];
98- [mutableAttributes setObject: newParagraphStyle forKey: NSParagraphStyleAttributeName ];
9985 [mutableAttributes setObject: newFont forKey: NSFontAttributeName ];
100- [mutableAttributes setObject: textColor forKey: NSForegroundColorAttributeName ];
10186 [mutableAttributedString setAttributes: mutableAttributes range: range];
10287 }];
10388
@@ -167,7 +152,7 @@ - (void)onDidFinishSetup:(NSNotification*)sender
167152 CGFloat width = editorTextView.bounds .size .width * kDefaultZoomLevel ;
168153
169154 NSRect frame = editorTextView.frame ;
170- frame.size .width -= ( width + kRightSidePadding ) ;
155+ frame.size .width -= width;
171156 [editorTextView setFrame: frame];
172157
173158 NSRect miniMapScrollViewFrame = NSMakeRect (editorContainerView.bounds .size .width - width - kRightSidePadding , 0 , width, editorScrollView.bounds .size .height );
@@ -194,9 +179,18 @@ - (void)onDidFinishSetup:(NSNotification*)sender
194179 [miniMapScrollView setDocumentView: miniMapTextView];
195180 [miniMapTextView release ];
196181
197- NSObject *DVTFontAndColorTheme = [NSClassFromString (@" DVTFontAndColorTheme" ) performSelector: @selector (currentTheme )];
198- NSColor *backgroundColor = [DVTFontAndColorTheme performSelector: @selector (sourceTextBackgroundColor )];
199- [miniMapTextView setBackgroundColor: [backgroundColor shadowWithLevel: kDefaultShadowLevel ]];
182+ NSColor *miniMapBackgroundColor = [NSColor clearColor ];
183+ Class DVTFontAndColorThemeClass = NSClassFromString (@" DVTFontAndColorTheme" );
184+ if ([DVTFontAndColorThemeClass respondsToSelector: @selector (currentTheme )]) {
185+ NSObject *theme = [DVTFontAndColorThemeClass performSelector: @selector (currentTheme )];
186+
187+ if ([theme respondsToSelector: @selector (sourceTextBackgroundColor )]) {
188+ miniMapBackgroundColor = [theme performSelector: @selector (sourceTextBackgroundColor )];
189+
190+ }
191+ }
192+
193+ [miniMapTextView setBackgroundColor: [miniMapBackgroundColor shadowWithLevel: kDefaultShadowLevel ]];
200194
201195 objc_setAssociatedObject (editorDocument, &kKeyMiniMapTextView , miniMapTextView, OBJC_ASSOCIATION_ASSIGN );
202196 objc_setAssociatedObject (editorScrollView, &kKeyMiniMapTextView , miniMapTextView, OBJC_ASSOCIATION_ASSIGN );
@@ -206,6 +200,7 @@ - (void)onDidFinishSetup:(NSNotification*)sender
206200 NSRect miniMapSelectionViewFrame = NSMakeRect (0 , 0 , miniMapScrollView.bounds .size .width , editorScrollView.visibleRect .size .height * kDefaultZoomLevel );
207201 SCSelectionView *miniMapSelectionView = [[SCSelectionView alloc ] initWithFrame: miniMapSelectionViewFrame];
208202 [miniMapSelectionView setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin | NSViewWidthSizable | NSViewHeightSizable | NSViewMinYMargin | NSViewMaxYMargin];
203+ // [miniMapSelectionView setShouldInverseColors:YES];
209204 [miniMapScrollView.contentView addSubview: miniMapSelectionView];
210205 [miniMapSelectionView release ];
211206
@@ -217,10 +212,12 @@ - (void)onDidFinishSetup:(NSNotification*)sender
217212
218213#pragma mark - NSLayoutManagerDelegate
219214
220- - (void )layoutManager : (NSLayoutManager *)layoutManager didCompleteLayoutForTextContainer : (NSTextContainer *)textContainer atEnd : (BOOL )layoutFinishedFlag
215+ - (void )layoutManager : (NSLayoutManager *)layoutManager didCompleteLayoutForTextContainer : (NSTextContainer *)textContainer atEnd : (BOOL )layoutFinished
221216{
222- NSScrollView *editorScrollView = objc_getAssociatedObject (textContainer, &kKeyEditorScrollView );
223- [self updateMiniMapForEditorScrollView: editorScrollView];
217+ if (layoutFinished) {
218+ NSScrollView *editorScrollView = objc_getAssociatedObject (textContainer, &kKeyEditorScrollView );
219+ [self updateMiniMapForEditorScrollView: editorScrollView];
220+ }
224221}
225222
226223- (NSDictionary *)layoutManager : (NSLayoutManager *)layoutManager shouldUseTemporaryAttributes : (NSDictionary *)attrs forDrawingToScreen : (BOOL )toScreen atCharacterIndex : (NSUInteger )charIndex effectiveRange : (NSRangePointer )effectiveCharRange
0 commit comments