Skip to content

Commit ec0601c

Browse files
committed
Better fix for selection view background colour on theme changes
1 parent e0f5e40 commit ec0601c

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

SCXcodeMinimap/SCMiniMapView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ - (void)updateTheme
138138
}
139139

140140
[self.textView setBackgroundColor:[miniMapBackgroundColor shadowWithLevel:kDefaultShadowLevel]];
141-
[self.selectionView setNeedsDisplay:YES];
141+
[self.selectionView setSelectionColor:nil];
142142
}
143143

144144
- (void)updateTextView

SCXcodeMinimap/SCSelectionView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
@interface SCSelectionView : NSView
1212

13+
@property (nonatomic, retain) NSColor *selectionColor;
1314
@property (nonatomic, assign) BOOL shouldInverseColors;
1415

1516
@end

SCXcodeMinimap/SCSelectionView.m

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@
88

99
#import "SCSelectionView.h"
1010

11-
@interface SCSelectionView ()
12-
13-
@property (nonatomic, retain) NSColor *selectionColor;
14-
15-
@end
16-
1711
@implementation SCSelectionView
12+
@synthesize selectionColor = _selectionColor;
1813

1914
- (void)dealloc
2015
{
@@ -28,14 +23,6 @@ - (void)drawRect:(NSRect)dirtyRect
2823
NSRectFill(dirtyRect);
2924
}
3025

31-
- (void)setNeedsDisplay:(BOOL)flag
32-
{
33-
if(self.needsDisplay == flag) return;
34-
35-
[self setSelectionColor:nil];
36-
[super setNeedsDisplay:flag];
37-
}
38-
3926
- (NSColor *)selectionColor
4027
{
4128
if(_selectionColor == nil) {
@@ -70,6 +57,14 @@ - (NSColor *)selectionColor
7057
return _selectionColor;
7158
}
7259

60+
- (void)setSelectionColor:(NSColor *)selectionColor
61+
{
62+
if([_selectionColor isEqual:selectionColor]) return;
63+
64+
_selectionColor = selectionColor;
65+
[self setNeedsDisplay:YES];
66+
}
67+
7368
- (void)setShouldInverseColors:(BOOL)shouldInverseColors
7469
{
7570
if(_shouldInverseColors == shouldInverseColors) {

0 commit comments

Comments
 (0)