[edited:range:changeInLength:] and [processEditing] corrected

reported range.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7272 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2000-08-27 22:31:32 +00:00
parent c92231d8e3
commit 97d141c652

View file

@ -144,10 +144,7 @@ static Class concrete;
} }
else else
{ {
if (editedRange.location > old.location) editedRange = NSUnionRange(editedRange, old);
editedRange.location = old.location;
if (NSMaxRange(editedRange) < NSMaxRange(old))
editedRange.length = NSMaxRange(old) - editedRange.location;
} }
/* /*
@ -161,6 +158,7 @@ static Class concrete;
// FIXME: this was > not >=, is that going to be a problem? // FIXME: this was > not >=, is that going to be a problem?
NSAssert(old.length >= -delta, NSInvalidArgumentException); NSAssert(old.length >= -delta, NSInvalidArgumentException);
} }
editedRange.length += delta;
editedDelta += delta; editedDelta += delta;
} }
@ -193,7 +191,6 @@ static Class concrete;
object: self]; object: self];
r = editedRange; r = editedRange;
r.length += editedDelta;
// Multiple adds at the end might give a too long result // Multiple adds at the end might give a too long result
if (NSMaxRange(r) > [self length]) if (NSMaxRange(r) > [self length])
r.length = [self length] - r.location; r.length = [self length] - r.location;
@ -208,15 +205,16 @@ static Class concrete;
* Calls textStorage:edited:range:changeInLength:invalidatedRange: for * Calls textStorage:edited:range:changeInLength:invalidatedRange: for
* every layoutManager. * every layoutManager.
* *
* FIXME, Michael: are the ranges used correct? * FIXME: The invalidatedRange is not correct, this should include the
* surrounding paragraphs.
*/ */
for (i=0;i<[layoutManagers count];i++) for (i=0;i<[layoutManagers count];i++)
{ {
NSLayoutManager *lManager = [layoutManagers objectAtIndex:i]; NSLayoutManager *lManager = [layoutManagers objectAtIndex:i];
[lManager textStorage:self edited:editedMask range:editedRange [lManager textStorage: self edited: editedMask range: r
changeInLength:editedDelta invalidatedRange:r]; changeInLength: editedDelta invalidatedRange: r];
} }
/* /*