git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4645 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-07-25 10:36:37 +00:00
parent 5473688c96
commit a3e42efb33
2 changed files with 32 additions and 13 deletions

View file

@ -1,3 +1,9 @@
Sun Jul 25 11:40:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/GSTextStorage.m: Modified ([-setAttributes:range:]) and
([-replaceCharactersinRange:withString:]) to call
([-edited:range:changeInLength:) on completion.
1999-07-24 Michael Hanni <mhanni@sprintmail.com>
* Headers/NSTextView.h: redid ivars.

View file

@ -329,6 +329,17 @@ _attributesAtIndexEffectiveRange(
index, aRange, [textChars length], infoArray, NULL);
}
/*
* Primitive method! Sets attributes and values for a given range of
* characters, replacing any previous attributes and values for that
* range.
*
* Sets the attributes for the characters in aRange to attributes.
* These new attributes replace any attributes previously associated
* with the characters in aRange. Raises an NSRangeException if any
* part of aRange lies beyond the end of the receiver's characters.
* See also: - addAtributes: range: , - removeAttributes: range:
*/
- (void) setAttributes: (NSDictionary*)attributes
range: (NSRange)range
{
@ -398,23 +409,17 @@ _attributesAtIndexEffectiveRange(
}
/*
* Primitive method! Sets attributes and values for a given range of
* characters, replacing any previous attributes and values for that
* range.
*/
/*
* Sets the attributes for the characters in aRange to attributes.
* These new attributes replace any attributes previously associated
* with the characters in aRange. Raises an NSRangeException if any
* part of aRange lies beyond the end of the receiver's characters.
* See also: - addAtributes: range: , - removeAttributes: range:
*/
* Keep track of changes.
*/
[self edited: NSTextStorageEditedAttributes
range: range
changeinlength: 0];
}
- (void) replaceCharactersInRange: (NSRange)range
withString: (NSString*)aString
{
unsigned aLength;
unsigned tmpLength, arrayIndex, arraySize, cnt, moveLocations;
NSRange effectiveRange;
NSDictionary *attrs;
@ -424,6 +429,7 @@ _attributesAtIndexEffectiveRange(
if (!aString)
aString = @"";
aLength = [aString length];
tmpLength = [textChars length];
GS_RANGE_CHECK(range, tmpLength);
arraySize = (*cntImp)(infoArray, cntSel);
@ -432,7 +438,7 @@ _attributesAtIndexEffectiveRange(
attrs = _attributesAtIndexEffectiveRange(
NSMaxRange(range), &effectiveRange, tmpLength, infoArray, &arrayIndex);
moveLocations = [aString length] - range.length;
moveLocations = aLength - range.length;
afterRangeLoc = NSMaxRange(range) + moveLocations;
if (effectiveRange.location > range.location)
@ -480,6 +486,13 @@ _attributesAtIndexEffectiveRange(
arrayIndex--;
}
[textChars replaceCharactersInRange: range withString: aString];
/*
* Keep track of changes.
*/
[self edited: NSTextStorageEditedCharacters
range: range
changeinlength: aLength - range.length];
}
- (void) dealloc