@@ -529,15 +529,14 @@ - (void)updateOffset
529
529
return ;
530
530
}
531
531
532
- CGFloat ratio = (adjustedMinimapContentHeight / adjustedEditorContentHeight) * (1 / self.scrollView .magnification );
533
- CGPoint offset =NSMakePoint (self.editor .scrollView .contentView .bounds .origin .x ,
534
- MAX (0 ,floorf (self.editor .scrollView .contentView .bounds .origin .y * ratio * self.scrollView .magnification )));
535
-
536
- [self .scrollView.documentViewscrollPoint: offset];
532
+ CGFloat editorYOffset =CGRectGetMinY (self.editor .scrollView .contentView .bounds ) +ABS (CGRectGetMinY (self.editorTextView .frame ));
537
533
534
+ CGFloat ratio = (adjustedMinimapContentHeight / adjustedEditorContentHeight) * (1 / self.scrollView .magnification );
535
+ [self .scrollView.documentViewscrollPoint: NSMakePoint (self .editor.scrollView.contentView.bounds.origin.x,
536
+ MAX (0 ,floorf (editorYOffset * ratio *self .scrollView.magnification)))];
538
537
539
538
ratio = (editorTextHeight - self.selectionView .bounds .size .height ) / adjustedEditorContentHeight;
540
- selectionViewFrame.origin .y =self. editor . scrollView . contentView . bounds . origin . y * ratio;
539
+ selectionViewFrame.origin .y =editorYOffset * ratio;
541
540
542
541
[self .selectionViewsetFrame: selectionViewFrame];
543
542
}
@@ -569,6 +568,7 @@ - (void)handleMouseEvent:(NSEvent *)theEvent
569
568
570
569
NSRect neededRect = [self .editorTextView.layoutManagerboundingRectForGlyphRange: activeRangeinTextContainer: self .editorTextView.textContainer];
571
570
neededRect.origin .y =MAX (0 , neededRect.origin .y -CGRectGetHeight (self.editor .containerView .bounds ) /2 );
571
+ neededRect.origin .y +=CGRectGetMinY (self.editorTextView .frame );
572
572
573
573
BOOL shouldAnimateContentOffset = (theEvent.type !=NSLeftMouseDragged );
574
574