@@ -466,8 +466,7 @@ - (void)foldingManager:(DVTFoldingManager *)foldingManager didFoldRange:(NSRange
466
466
[(DVTLayoutManager *)self .editorTextView.layoutManagerfoldingManager: foldingManagerdidFoldRange: range];
467
467
468
468
[self .textView.layoutManager.foldingManagerfoldRange: range];
469
-
470
- [self .textView.layoutManagerensureLayoutForTextContainer: self .textView.textContainer];
469
+
471
470
[self updateOffset ];
472
471
}
473
472
@@ -476,8 +475,7 @@ - (void)foldingManager:(DVTFoldingManager *)foldingManager didUnfoldRange:(NSRan
476
475
[(DVTLayoutManager *)self .editorTextView.layoutManagerfoldingManager: foldingManagerdidUnfoldRange: range];
477
476
478
477
[self .textView.layoutManager.foldingManagerunfoldRange: range];
479
-
480
- [self .textView.layoutManagerensureLayoutForTextContainer: self .textView.textContainer];
478
+
481
479
[self updateOffset ];
482
480
}
483
481
@@ -621,7 +619,9 @@ - (void)updateSearchResults
621
619
622
620
- (void )updateOffset
623
621
{
624
- [self .editorTextView.layoutManagerensureLayoutForTextContainer: self .editorTextView.textContainer];
622
+ if (!self.editorTextView .textStorage .editedMask ) {
623
+ [self .editorTextView.layoutManagerensureLayoutForTextContainer: self .editorTextView.textContainer];
624
+ }
625
625
626
626
CGFloat editorTextHeight =CGRectGetHeight ([self .editorTextView.layoutManagerusedRectForTextContainer: self .editorTextView.textContainer]);
627
627
CGFloat adjustedEditorContentHeight = editorTextHeight -CGRectGetHeight (self.editor .scrollView .bounds );