diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index 0f5198d81..a95728d39 100755 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -1465,7 +1465,12 @@ var kDelegateRespondsTo_textShouldBeginEditing var minSize = [self minSize], maxSize = [self maxSize], desiredSize = aSize, - rect = [_layoutManager boundingRectForGlyphRange:CPMakeRange(0, MAX(0, [_layoutManager numberOfCharacters] - 1)) inTextContainer:_textContainer]; + rect = [_layoutManager boundingRectForGlyphRange:CPMakeRange(0, MAX(0, [_layoutManager numberOfCharacters] - 1)) inTextContainer:_textContainer], + myClipviewSize = nil; + + if ([[self superview] isKindOfClass:[CPClipView class]]) + myClipviewSize = [[self superview] frame].size; + if ([_layoutManager extraLineFragmentTextContainer] === _textContainer) rect = CGRectUnion(rect, [_layoutManager extraLineFragmentRect]); @@ -1490,6 +1495,14 @@ var kDelegateRespondsTo_textShouldBeginEditing desiredSize.height = maxSize.height; } + if (myClipviewSize) + { + if (desiredSize.width < myClipviewSize.width) + desiredSize.width = myClipviewSize.width; + if (desiredSize.height < myClipviewSize.height) + desiredSize.height = myClipviewSize.height; + } + [super setFrameSize:desiredSize]; }