Skip to content

Commit bf960ed

Browse files
committed
Remove unnecessary ensyreLayoutForTextContainer calls and prevented calling it while the text storage is modified.
1 parent 1e5858d commit bf960ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

SCXcodeMinimap/SCXcodeMinimapView.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,7 @@ - (void)foldingManager:(DVTFoldingManager *)foldingManager didFoldRange:(NSRange
466466
[(DVTLayoutManager *)self.editorTextView.layoutManager foldingManager:foldingManager didFoldRange:range];
467467

468468
[self.textView.layoutManager.foldingManager foldRange:range];
469-
470-
[self.textView.layoutManager ensureLayoutForTextContainer:self.textView.textContainer];
469+
471470
[self updateOffset];
472471
}
473472

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

478477
[self.textView.layoutManager.foldingManager unfoldRange:range];
479-
480-
[self.textView.layoutManager ensureLayoutForTextContainer:self.textView.textContainer];
478+
481479
[self updateOffset];
482480
}
483481

@@ -621,7 +619,9 @@ - (void)updateSearchResults
621619

622620
- (void)updateOffset
623621
{
624-
[self.editorTextView.layoutManager ensureLayoutForTextContainer:self.editorTextView.textContainer];
622+
if(!self.editorTextView.textStorage.editedMask) {
623+
[self.editorTextView.layoutManager ensureLayoutForTextContainer:self.editorTextView.textContainer];
624+
}
625625

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

0 commit comments

Comments
 (0)