The R Project SVN R-packages

Rev

Rev 6249 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6249 Rev 7916
Line 75... Line 75...
75
{
75
{
76
	self = [super init];
76
	self = [super init];
77
 
77
 
78
	if (self != nil) {
78
	if (self != nil) {
79
		_attributedString = [[NSTextStorage alloc] init];
79
		_attributedString = [[NSTextStorage alloc] init];
80
		_getImp  = [_attributedString methodForSelector:_getSel];
-
 
81
		_setImp  = [_attributedString methodForSelector:_setSel];
-
 
82
		_strImp  = [_attributedString methodForSelector:_strSel];
-
 
83
		_replImp = [_attributedString methodForSelector:_replSel];
-
 
84
		_editImp = [self methodForSelector:_editSel];
-
 
85
		_getlImp = [_attributedString methodForSelector:_getlSel];
-
 
86
 
80
 
87
		selfDelegate = (RScriptEditorTextView*)theDelegate;
81
		selfDelegate = (RScriptEditorTextView*)theDelegate;
88
		[self setDelegate:theDelegate];
82
		[self setDelegate:theDelegate];
89
		foldedCounter = 0;
83
		foldedCounter = 0;
90
		currentMaxFoldedIndex = -1;
84
		currentMaxFoldedIndex = -1;
Line 302... Line 296...
302
#pragma mark -
296
#pragma mark -
303
#pragma mark Primitives
297
#pragma mark Primitives
304
 
298
 
305
- (NSString *)string
299
- (NSString *)string
306
{ 
300
{ 
307
	return (*_strImp)(_attributedString, _strSel);
301
    return _attributedString ? [_attributedString string] : nil;
308
}
302
}
309
 
303
 
310
- (NSDictionary *)attributesAtIndex:(NSUInteger)location effectiveRange:(NSRangePointer)range
304
- (NSDictionary *)attributesAtIndex:(NSUInteger)location effectiveRange:(NSRangePointer)range
311
{
305
{
312
 
306
 
313
	NSDictionary *attributes = (*_getImp)(_attributedString, _getSel, location, range);
307
    NSDictionary *attributes = [_attributedString attributesAtIndex:location effectiveRange:range];
314
 
308
 
315
	if(!foldedCounter || location > [_attributedString length]) return attributes;
309
	if(!foldedCounter || location > [_attributedString length]) return attributes;
316
 
310
 
317
	NSRange effectiveRange;
311
	NSRange effectiveRange;
318
 
312
 
Line 379... Line 373...
379
}
373
}
380
 
374
 
381
// NSMutableAttributedString primitives
375
// NSMutableAttributedString primitives
382
- (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str
376
- (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str
383
{
377
{
384
	(*_replImp)(_attributedString, _replSel, range, str);
378
    [_attributedString replaceCharactersInRange:range withString:str];
385
	(*_editImp)(self, _editSel, NSTextStorageEditedCharacters, range, [str length] - range.length);
379
    [self edited:NSTextStorageEditedCharacters range:range changeInLength: [str length] - range.length];
386
}
380
}
387
 
381
 
388
- (void)setAttributes:(NSDictionary *)attrs range:(NSRange)range
382
- (void)setAttributes:(NSDictionary *)attrs range:(NSRange)range
389
{
383
{
390
	(*_setImp)(_attributedString, _setSel, attrs, range);
384
    [_attributedString setAttributes:attrs range:range];
391
	(*_editImp)(self, _editSel, NSTextStorageEditedAttributes, range, 0);
385
    [self edited:NSTextStorageEditedAttributes range:range changeInLength:0];
392
}
386
}
393
 
387
 
394
// Attribute Fixing Overrides
388
// Attribute Fixing Overrides
395
/*
389
/*
396
- (void)fixAttributesInRange:(NSRange)range
390
- (void)fixAttributesInRange:(NSRange)range