mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 22:00:46 +00:00
* 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:
parent
96843b7efa
commit
628f1e3658
2 changed files with 30 additions and 0 deletions
|
@ -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>
|
2011-06-13 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* Source/NSView.m (-scrollRectToVisible:): Work when the receiver
|
* Source/NSView.m (-scrollRectToVisible:): Work when the receiver
|
||||||
|
|
|
@ -2860,6 +2860,7 @@ Scroll so that the beginning of the range is visible.
|
||||||
NSView *cv;
|
NSView *cv;
|
||||||
float width;
|
float width;
|
||||||
NSPoint p0, p1;
|
NSPoint p0, p1;
|
||||||
|
NSRange ourCharRange;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Make sure that our size is up-to-date. If the scroll is in response to
|
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)
|
if (_layoutManager == nil)
|
||||||
return;
|
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)
|
if (aRange.length > 0)
|
||||||
{
|
{
|
||||||
aRange.length = 1;
|
aRange.length = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue