Skip to content

Commit 3b96fb8

Browse files
committed
- reduced number of syntax highlighting calls
- fixed show/hide minimap menu item state - fixed crash when being removed from the superview
1 parent a2e3858 commit 3b96fb8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

SCXcodeMinimap/SCXcodeMinimap.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ - (void)toggleMinimap:(NSMenuItem *)sender
247247
{
248248
BOOL shouldDisplayMinimap = [[[NSUserDefaults standardUserDefaults] objectForKey:SCXcodeMinimapShouldDisplayKey] boolValue];
249249

250-
[sender setTitle:(shouldDisplayMinimap ? kHideMinimapMenuItemTitle : kShowMinimapMenuItemTitle)];
250+
[sender setTitle:(!shouldDisplayMinimap ? kHideMinimapMenuItemTitle : kShowMinimapMenuItemTitle)];
251251
[[NSUserDefaults standardUserDefaults] setObject:@(!shouldDisplayMinimap) forKey:SCXcodeMinimapShouldDisplayKey];
252252
[[NSNotificationCenter defaultCenter] postNotificationName:SCXcodeMinimapShouldDisplayChangeNotification object:nil];
253253
}

SCXcodeMinimap/SCXcodeMinimapView.m

+8-1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ - (instancetype)initWithEditor:(IDESourceCodeEditor *)editor
221221

222222
- (void)viewDidMoveToWindow
223223
{
224+
if(self.window == nil) {
225+
return;
226+
}
227+
224228
[self setVisible:[[[NSUserDefaults standardUserDefaults] objectForKey:SCXcodeMinimapShouldDisplayKey] boolValue]];
225229
}
226230

@@ -231,7 +235,6 @@ - (void)setVisible:(BOOL)visible
231235
self.hidden = !visible;
232236

233237
[self updateSize];
234-
[self updateOffset];
235238

236239
[self.textView.layoutManager setDelegate:(self.hidden ? nil : self)];
237240

@@ -516,12 +519,16 @@ - (void)updateSize
516519

517520
CGFloat actualZoomLevel = CGRectGetWidth(self.bounds) / CGRectGetWidth(self.editor.textView.bounds);
518521
[self.scrollView setMagnification:actualZoomLevel];
522+
523+
[self updateOffset];
519524
}
520525

521526
- (void)resizeWithOldSuperviewSize:(NSSize)oldSize
522527
{
523528
[super resizeWithOldSuperviewSize:oldSize];
524529

530+
self.shouldAllowFullSyntaxHighlight = NO;
531+
525532
CGRect frame = self.textView.bounds;
526533
frame.size.width = CGRectGetWidth(self.editorTextView.bounds);
527534
[self.textView setFrame:frame];

0 commit comments

Comments
 (0)