Skip to content

Commit 0df8bb8

Browse files
committed
#7 Only cover as much space as needed.
1 parent ec0601c commit 0df8bb8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

SCXcodeMinimap/SCMiniMapView.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111

1212
static NSString * const DVTFontAndColorSourceTextSettingsChangedNotification = @"DVTFontAndColorSourceTextSettingsChangedNotification";
1313

14+
@interface SCMiniMapView ()
15+
16+
@property (nonatomic, retain) NSColor *backgroundColor;
17+
18+
@end
19+
1420
@implementation SCMiniMapView
1521

1622
- (id)initWithFrame:(NSRect)frame
@@ -60,6 +66,8 @@ - (NSTextView *)textView
6066
if (_textView == nil) {
6167
_textView = [[NSTextView alloc] initWithFrame:self.bounds];
6268
[_textView setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin | NSViewWidthSizable | NSViewHeightSizable];
69+
[_textView setBackgroundColor:[NSColor clearColor]];
70+
6371
[_textView.textContainer setLineFragmentPadding:0.0f];
6472

6573
[_textView.layoutManager setDelegate:self];
@@ -137,7 +145,8 @@ - (void)updateTheme
137145
}
138146
}
139147

140-
[self.textView setBackgroundColor:[miniMapBackgroundColor shadowWithLevel:kDefaultShadowLevel]];
148+
self.backgroundColor = [miniMapBackgroundColor shadowWithLevel:kDefaultShadowLevel];
149+
[self.textView.textStorage addAttribute:NSBackgroundColorAttributeName value:self.backgroundColor range:NSMakeRange(0, self.textView.textStorage.length)];
141150
[self.selectionView setSelectionColor:nil];
142151
}
143152

@@ -165,6 +174,7 @@ - (void)updateTextView
165174
}];
166175

167176
[self.textView.textStorage setAttributedString:mutableAttributedString];
177+
[self.textView.textStorage addAttribute:NSBackgroundColorAttributeName value:self.backgroundColor range:NSMakeRange(0, self.textView.textStorage.length)];
168178
[mutableAttributedString release];
169179
}
170180

0 commit comments

Comments
 (0)