Skip to content

Commit

Permalink
Remove unnecessary ensyreLayoutForTextContainer calls and prevented c…
Browse files Browse the repository at this point in the history
…alling it while the text storage is modified.
  • Loading branch information
stefanceriu committed Jun 23, 2016
1 parent 1e5858d commit bf960ed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions SCXcodeMinimap/SCXcodeMinimapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,7 @@ - (void)foldingManager:(DVTFoldingManager *)foldingManager didFoldRange:(NSRange
[(DVTLayoutManager *)self.editorTextView.layoutManager foldingManager:foldingManager didFoldRange:range];

[self.textView.layoutManager.foldingManager foldRange:range];

[self.textView.layoutManager ensureLayoutForTextContainer:self.textView.textContainer];

[self updateOffset];
}

Expand All @@ -476,8 +475,7 @@ - (void)foldingManager:(DVTFoldingManager *)foldingManager didUnfoldRange:(NSRan
[(DVTLayoutManager *)self.editorTextView.layoutManager foldingManager:foldingManager didUnfoldRange:range];

[self.textView.layoutManager.foldingManager unfoldRange:range];

[self.textView.layoutManager ensureLayoutForTextContainer:self.textView.textContainer];

[self updateOffset];
}

Expand Down Expand Up @@ -621,7 +619,9 @@ - (void)updateSearchResults

- (void)updateOffset
{
[self.editorTextView.layoutManager ensureLayoutForTextContainer:self.editorTextView.textContainer];
if(!self.editorTextView.textStorage.editedMask) {
[self.editorTextView.layoutManager ensureLayoutForTextContainer:self.editorTextView.textContainer];
}

CGFloat editorTextHeight = CGRectGetHeight([self.editorTextView.layoutManager usedRectForTextContainer:self.editorTextView.textContainer]);
CGFloat adjustedEditorContentHeight = editorTextHeight - CGRectGetHeight(self.editor.scrollView.bounds);
Expand Down

0 comments on commit bf960ed

Please sign in to comment.