* Source/NSTextView.m (-scrollRangeToVisible:): Work with ranges

outside the receiver (in a situation with multiple NSTextView's
connected to a layout manager)


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33298 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-06-14 02:32:55 +00:00
parent 1a25ffa41e
commit f2f4ab4076
2 changed files with 30 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2011-06-13 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSTextView.m (-scrollRangeToVisible:): Work with ranges
outside the receiver (in a situation with multiple NSTextView's
connected to a layout manager)
2011-06-13 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSView.m (-scrollRectToVisible:): Work when the receiver

View file

@ -2860,6 +2860,7 @@ Scroll so that the beginning of the range is visible.
NSView *cv;
float width;
NSPoint p0, p1;
NSRange ourCharRange;
/*
Make sure that our size is up-to-date. If the scroll is in response to
@ -2874,6 +2875,29 @@ Scroll so that the beginning of the range is visible.
if (_layoutManager == nil)
return;
/* See if the requested range lies outside of the receiver. If so
* forward the call to the appropriate text view.
*/
ourCharRange = [_layoutManager characterRangeForGlyphRange: [_layoutManager glyphRangeForTextContainer:
[self textContainer]]
actualGlyphRange: NULL];
if (NSMaxRange(aRange) < ourCharRange.location ||
aRange.location > NSMaxRange(ourCharRange))
{
NSTextContainer *tc = [_layoutManager textContainerForGlyphAtIndex:
[_layoutManager glyphRangeForCharacterRange: aRange
actualCharacterRange: NULL].location
effectiveRange: NULL];
NSTextView *tv = [tc textView];
if (tv != self)
{
[tv scrollRangeToVisible: aRange];
return;
}
}
if (aRange.length > 0)
{
aRange.length = 1;