| Line 66... |
Line 66... |
| 66 |
#define kBTQuote @"BTQuote"
|
66 |
#define kBTQuote @"BTQuote"
|
| 67 |
#define kBTQuoteValue @"isBTQuoted"
|
67 |
#define kBTQuoteValue @"isBTQuoted"
|
| 68 |
|
68 |
|
| 69 |
#pragma mark -
|
69 |
#pragma mark -
|
| 70 |
|
70 |
|
| 71 |
#define R_SYNTAX_HILITE_BIAS 2000
|
71 |
#define R_SYNTAX_HILITE_BIAS 3000
|
| 72 |
#define R_MAX_TEXT_SIZE_FOR_SYNTAX_HIGHLIGHTING 20000000
|
72 |
#define R_MAX_TEXT_SIZE_FOR_SYNTAX_HIGHLIGHTING 20000000
|
| 73 |
|
73 |
|
| 74 |
|
74 |
|
| 75 |
static inline const char* NSStringUTF8String(NSString* self)
|
75 |
static inline const char* NSStringUTF8String(NSString* self)
|
| 76 |
{
|
76 |
{
|
| Line 119... |
Line 119... |
| 119 |
[[self textStorage] setDelegate:self];
|
119 |
[[self textStorage] setDelegate:self];
|
| 120 |
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
120 |
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
| 121 |
[[self layoutManager] setAllowsNonContiguousLayout:YES];
|
121 |
[[self layoutManager] setAllowsNonContiguousLayout:YES];
|
| 122 |
#endif
|
122 |
#endif
|
| 123 |
|
123 |
|
| 124 |
|
- |
|
| 125 |
// Set defaults for general usage
|
124 |
// Set defaults for general usage
|
| 126 |
braceHighlightInterval = [Preferences floatForKey:HighlightIntervalKey withDefault:0.3f];
|
125 |
braceHighlightInterval = [Preferences floatForKey:HighlightIntervalKey withDefault:0.3f];
|
| 127 |
lineNumberingEnabled = [Preferences flagForKey:showLineNumbersKey withDefault:NO];
|
126 |
lineNumberingEnabled = [Preferences flagForKey:showLineNumbersKey withDefault:NO];
|
| 128 |
argsHints = [Preferences flagForKey:prefShowArgsHints withDefault:YES];
|
127 |
argsHints = [Preferences flagForKey:prefShowArgsHints withDefault:YES];
|
| 129 |
lineWrappingEnabled = [Preferences flagForKey:enableLineWrappingKey withDefault:YES];
|
128 |
lineWrappingEnabled = [Preferences flagForKey:enableLineWrappingKey withDefault:YES];
|
| Line 152... |
Line 151... |
| 152 |
[self setContinuousSpellCheckingEnabled:NO];
|
151 |
[self setContinuousSpellCheckingEnabled:NO];
|
| 153 |
|
152 |
|
| 154 |
if(![Preferences flagForKey:enableLineWrappingKey withDefault: YES])
|
153 |
if(![Preferences flagForKey:enableLineWrappingKey withDefault: YES])
|
| 155 |
[scrollView setHasHorizontalScroller:YES];
|
154 |
[scrollView setHasHorizontalScroller:YES];
|
| 156 |
|
155 |
|
| - |
|
156 |
if(!lineWrappingEnabled)
|
| - |
|
157 |
[self updateLineWrappingMode];
|
| - |
|
158 |
|
| 157 |
// Re-define tab stops for a better editing
|
159 |
// Re-define tab stops for a better editing
|
| 158 |
[self setTabStops];
|
160 |
[self setTabStops];
|
| 159 |
|
161 |
|
| 160 |
// disabled to get the current text range in textView safer
|
162 |
// disabled to get the current text range in textView safer
|
| 161 |
[[self layoutManager] setBackgroundLayoutEnabled:NO];
|
163 |
[[self layoutManager] setBackgroundLayoutEnabled:NO];
|
| 162 |
|
164 |
|
| 163 |
// add NSViewBoundsDidChangeNotification to scrollView
|
165 |
// add NSViewBoundsDidChangeNotification to scrollView
|
| 164 |
[scrollView setPostsBoundsChangedNotifications:YES];
|
- |
|
| 165 |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boundsDidChangeNotification:) name:NSViewBoundsDidChangeNotification object:[scrollView contentView]];
|
166 |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(boundsDidChangeNotification:) name:NSViewBoundsDidChangeNotification object:[scrollView contentView]];
|
| 166 |
|
167 |
|
| 167 |
NSColor *c = [Preferences unarchivedObjectForKey:normalSyntaxColorKey withDefault:nil];
|
168 |
NSColor *c = [Preferences unarchivedObjectForKey:normalSyntaxColorKey withDefault:nil];
|
| 168 |
if (c) shColorNormal = c;
|
169 |
if (c) shColorNormal = c;
|
| 169 |
else shColorNormal=[NSColor colorWithDeviceRed:0.025 green:0.085 blue:0.600 alpha:1.0];
|
170 |
else shColorNormal=[NSColor colorWithDeviceRed:0.025 green:0.085 blue:0.600 alpha:1.0];
|
| Line 224... |
Line 225... |
| 224 |
[prefs addObserver:self forKeyPath:prefShowArgsHints options:NSKeyValueObservingOptionNew context:NULL];
|
225 |
[prefs addObserver:self forKeyPath:prefShowArgsHints options:NSKeyValueObservingOptionNew context:NULL];
|
| 225 |
[prefs addObserver:self forKeyPath:enableLineWrappingKey options:NSKeyValueObservingOptionNew context:NULL];
|
226 |
[prefs addObserver:self forKeyPath:enableLineWrappingKey options:NSKeyValueObservingOptionNew context:NULL];
|
| 226 |
[prefs addObserver:self forKeyPath:RScriptEditorDefaultFont options:NSKeyValueObservingOptionNew context:NULL];
|
227 |
[prefs addObserver:self forKeyPath:RScriptEditorDefaultFont options:NSKeyValueObservingOptionNew context:NULL];
|
| 227 |
[prefs addObserver:self forKeyPath:HighlightIntervalKey options:NSKeyValueObservingOptionNew context:NULL];
|
228 |
[prefs addObserver:self forKeyPath:HighlightIntervalKey options:NSKeyValueObservingOptionNew context:NULL];
|
| 228 |
[prefs addObserver:self forKeyPath:highlightCurrentLine options:NSKeyValueObservingOptionNew context:NULL];
|
229 |
[prefs addObserver:self forKeyPath:highlightCurrentLine options:NSKeyValueObservingOptionNew context:NULL];
|
| - |
|
230 |
[prefs addObserver:self forKeyPath:showLineNumbersKey options:NSKeyValueObservingOptionNew context:NULL];
|
| 229 |
|
231 |
|
| 230 |
theTextStorage = [self textStorage];
|
232 |
theTextStorage = [self textStorage];
|
| 231 |
}
|
233 |
}
|
| 232 |
|
234 |
|
| 233 |
- (void)dealloc {
|
235 |
- (void)dealloc {
|
| 234 |
SLog(@"RScriptEditorTextView: dealloc <%@>", self);
|
236 |
SLog(@"RScriptEditorTextView: dealloc <%@>", self);
|
| 235 |
|
237 |
|
| 236 |
|
- |
|
| 237 |
if(editorToolbar) [editorToolbar release];
|
238 |
if(editorToolbar) [editorToolbar release];
|
| 238 |
|
239 |
|
| 239 |
if(highlightColorAttr) [highlightColorAttr release];
|
240 |
if(highlightColorAttr) [highlightColorAttr release];
|
| 240 |
|
241 |
|
| 241 |
if(shColorNormal) [shColorNormal release];
|
242 |
if(shColorNormal) [shColorNormal release];
|
| Line 296... |
Line 297... |
| 296 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
|
297 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
|
| 297 |
} else if ([keyPath isEqualToString:editorCursorColorKey]) {
|
298 |
} else if ([keyPath isEqualToString:editorCursorColorKey]) {
|
| 298 |
if(shColorCursor) [shColorCursor release];
|
299 |
if(shColorCursor) [shColorCursor release];
|
| 299 |
shColorCursor = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
300 |
shColorCursor = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
| 300 |
[self setInsertionPointColor:shColorCursor];
|
301 |
[self setInsertionPointColor:shColorCursor];
|
| 301 |
[self setNeedsDisplay:YES];
|
302 |
[self setNeedsDisplayInRect:[self bounds]];
|
| 302 |
} else if ([keyPath isEqualToString:identifierSyntaxColorKey]) {
|
303 |
} else if ([keyPath isEqualToString:identifierSyntaxColorKey]) {
|
| 303 |
if(shColorIdentifier) [shColorIdentifier release];
|
304 |
if(shColorIdentifier) [shColorIdentifier release];
|
| 304 |
shColorIdentifier = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
305 |
shColorIdentifier = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
| 305 |
if([self isEditable])
|
306 |
if([self isEditable])
|
| 306 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
|
307 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
|
| 307 |
} else if ([keyPath isEqualToString:editorBackgroundColorKey]) {
|
308 |
} else if ([keyPath isEqualToString:editorBackgroundColorKey]) {
|
| 308 |
if(shColorBackground) [shColorBackground release];
|
309 |
if(shColorBackground) [shColorBackground release];
|
| 309 |
shColorBackground = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
310 |
shColorBackground = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
| 310 |
[self setNeedsDisplay:YES];
|
311 |
[self setNeedsDisplayInRect:[self bounds]];
|
| 311 |
} else if ([keyPath isEqualToString:editorCurrentLineBackgroundColorKey]) {
|
312 |
} else if ([keyPath isEqualToString:editorCurrentLineBackgroundColorKey]) {
|
| 312 |
if(shColorCurrentLine) [shColorCurrentLine release];
|
313 |
if(shColorCurrentLine) [shColorCurrentLine release];
|
| 313 |
shColorCurrentLine = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
314 |
shColorCurrentLine = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
| 314 |
[self setNeedsDisplay:YES];
|
315 |
[self setNeedsDisplayInRect:[self bounds]];
|
| 315 |
|
316 |
|
| 316 |
} else if ([keyPath isEqualToString:showSyntaxColoringKey]) {
|
317 |
} else if ([keyPath isEqualToString:showSyntaxColoringKey]) {
|
| 317 |
syntaxHighlightingEnabled = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
|
318 |
syntaxHighlightingEnabled = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
|
| 318 |
if(syntaxHighlightingEnabled) {
|
319 |
if(syntaxHighlightingEnabled) {
|
| 319 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
|
320 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
|
| Line 322... |
Line 323... |
| 322 |
}
|
323 |
}
|
| 323 |
|
324 |
|
| 324 |
} else if ([keyPath isEqualToString:enableLineWrappingKey]) {
|
325 |
} else if ([keyPath isEqualToString:enableLineWrappingKey]) {
|
| 325 |
[self updateLineWrappingMode];
|
326 |
[self updateLineWrappingMode];
|
| 326 |
|
327 |
|
| - |
|
328 |
} else if ([keyPath isEqualToString:showLineNumbersKey]) {
|
| - |
|
329 |
lineNumberingEnabled = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
|
| - |
|
330 |
//TODO implement
|
| - |
|
331 |
if(lineNumberingEnabled) {
|
| - |
|
332 |
if(!theRulerView) {
|
| - |
|
333 |
theRulerView = [[NoodleLineNumberView alloc] initWithScrollView:scrollView];
|
| - |
|
334 |
[scrollView setVerticalRulerView:theRulerView];
|
| - |
|
335 |
}
|
| - |
|
336 |
[scrollView setHasHorizontalRuler:NO];
|
| - |
|
337 |
[scrollView setHasVerticalRuler:YES];
|
| - |
|
338 |
[scrollView setRulersVisible:YES];
|
| - |
|
339 |
} else {
|
| - |
|
340 |
[theRulerView release];
|
| - |
|
341 |
theRulerView = nil;
|
| - |
|
342 |
[scrollView setHasHorizontalRuler:NO];
|
| - |
|
343 |
[scrollView setHasVerticalRuler:NO];
|
| - |
|
344 |
[scrollView setRulersVisible:NO];
|
| - |
|
345 |
}
|
| - |
|
346 |
[self setNeedsDisplay:YES];
|
| - |
|
347 |
|
| 327 |
} else if ([keyPath isEqualToString:prefShowArgsHints]) {
|
348 |
} else if ([keyPath isEqualToString:prefShowArgsHints]) {
|
| 328 |
argsHints = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
|
349 |
argsHints = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
|
| 329 |
if(!argsHints) {
|
350 |
if(!argsHints) {
|
| 330 |
[[self delegate] setStatusLineText:@""];
|
351 |
[[self delegate] setStatusLineText:@""];
|
| 331 |
} else {
|
352 |
} else {
|
| 332 |
[self currentFunctionHint];
|
353 |
[self currentFunctionHint];
|
| 333 |
}
|
354 |
}
|
| 334 |
|
355 |
|
| 335 |
} else if ([keyPath isEqualToString:highlightCurrentLine]) {
|
356 |
} else if ([keyPath isEqualToString:highlightCurrentLine]) {
|
| 336 |
[self setNeedsDisplay:YES];
|
357 |
[self setNeedsDisplayInRect:[self bounds]];
|
| 337 |
|
358 |
|
| 338 |
} else if ([keyPath isEqualToString:RScriptEditorDefaultFont] && ![[[[self window] windowController] document] isRTF] && ![self selectedRange].length) {
|
359 |
} else if ([keyPath isEqualToString:RScriptEditorDefaultFont] && ![[[[self window] windowController] document] isRTF] && ![self selectedRange].length) {
|
| 339 |
[self setFont:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
|
360 |
[self setFont:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
|
| 340 |
[self setNeedsDisplay:YES];
|
361 |
[self setNeedsDisplayInRect:[self bounds]];
|
| 341 |
|
362 |
|
| 342 |
} else if ([keyPath isEqualToString:HighlightIntervalKey]) {
|
363 |
} else if ([keyPath isEqualToString:HighlightIntervalKey]) {
|
| 343 |
braceHighlightInterval = [Preferences floatForKey:HighlightIntervalKey withDefault:0.3f];
|
364 |
braceHighlightInterval = [Preferences floatForKey:HighlightIntervalKey withDefault:0.3f];
|
| 344 |
}
|
365 |
}
|
| 345 |
}
|
366 |
}
|
| Line 429... |
Line 450... |
| 429 |
// Cancel setting undo break point
|
450 |
// Cancel setting undo break point
|
| 430 |
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
451 |
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
| 431 |
selector:@selector(breakUndoCoalescing)
|
452 |
selector:@selector(breakUndoCoalescing)
|
| 432 |
object:nil];
|
453 |
object:nil];
|
| 433 |
|
454 |
|
| 434 |
// Cancel calling doSyntaxHighlighting
|
455 |
// Cancel calling functionRescan
|
| 435 |
[NSObject cancelPreviousPerformRequestsWithTarget:[self delegate]
|
456 |
[NSObject cancelPreviousPerformRequestsWithTarget:[self delegate]
|
| 436 |
selector:@selector(functionRescan)
|
457 |
selector:@selector(functionRescan)
|
| 437 |
object:nil];
|
458 |
object:nil];
|
| 438 |
|
459 |
|
| 439 |
// Improve undo behaviour, i.e. it depends how fast the user types
|
460 |
// Improve undo behaviour, i.e. it depends how fast the user types
|
| Line 448... |
Line 469... |
| 448 |
|
469 |
|
| 449 |
}
|
470 |
}
|
| 450 |
|
471 |
|
| 451 |
#pragma mark -
|
472 |
#pragma mark -
|
| 452 |
|
473 |
|
| - |
|
474 |
- (BOOL)lineNumberingEnabled
|
| - |
|
475 |
{
|
| - |
|
476 |
return lineNumberingEnabled;
|
| - |
|
477 |
}
|
| - |
|
478 |
|
| 453 |
- (void)setDeleteBackward:(BOOL)delBack
|
479 |
- (void)setDeleteBackward:(BOOL)delBack
|
| 454 |
{
|
480 |
{
|
| 455 |
deleteBackward = delBack;
|
481 |
deleteBackward = delBack;
|
| 456 |
}
|
482 |
}
|
| 457 |
|
483 |
|
| Line 518... |
Line 544... |
| 518 |
* Some sample code from Andrew Choi ( http://members.shaw.ca/akochoi-old/blog/2003/11-09/index.html#3 ) has been reused.
|
544 |
* Some sample code from Andrew Choi ( http://members.shaw.ca/akochoi-old/blog/2003/11-09/index.html#3 ) has been reused.
|
| 519 |
*/
|
545 |
*/
|
| 520 |
- (void)doSyntaxHighlighting
|
546 |
- (void)doSyntaxHighlighting
|
| 521 |
{
|
547 |
{
|
| 522 |
|
548 |
|
| 523 |
if (isSyntaxHighlighting || !syntaxHighlightingEnabled || [[self delegate] plain] || [theTextStorage length] > 40000000) return;
|
549 |
if (!syntaxHighlightingEnabled || [[self delegate] plain]) return;
|
| - |
|
550 |
|
| - |
|
551 |
isSyntaxHighlighting = YES;
|
| 524 |
|
552 |
|
| 525 |
NSString *selfstr = [theTextStorage string];
|
553 |
NSString *selfstr = [theTextStorage string];
|
| 526 |
NSInteger strlength = (NSInteger)[selfstr length];
|
554 |
NSInteger strlength = (NSInteger)[selfstr length];
|
| 527 |
|
555 |
|
| 528 |
// Avoid syntax highlighting of a big change but re-trigger it for highlighting it partly
|
- |
|
| 529 |
if([theTextStorage editedRange].length > (int)(R_SYNTAX_HILITE_BIAS * 4)) {
|
- |
|
| 530 |
[self insertText:@""];
|
- |
|
| 531 |
// remove inserting action from undo manager is keep edit status
|
- |
|
| 532 |
[[self undoManager] undo];
|
- |
|
| 533 |
return;
|
- |
|
| 534 |
}
|
- |
|
| 535 |
|
- |
|
| 536 |
// == Do highlighting partly (max R_SYNTAX_HILITE_BIAS*2 around visibleRange
|
556 |
// == Do highlighting partly (max R_SYNTAX_HILITE_BIAS*2 around visibleRange
|
| 537 |
// by considering entire lines).
|
557 |
// by considering entire lines).
|
| 538 |
|
558 |
|
| 539 |
// Get the text range currently displayed in the view port
|
559 |
// Get the text range currently displayed in the view port
|
| 540 |
NSRect visibleRect = [[[self enclosingScrollView] contentView] documentVisibleRect];
|
560 |
NSRect visibleRect = [[[self enclosingScrollView] contentView] documentVisibleRect];
|
| 541 |
NSRange visibleRange = [[self layoutManager] glyphRangeForBoundingRectWithoutAdditionalLayout:visibleRect inTextContainer:[self textContainer]];
|
561 |
NSRange visibleRange = [[self layoutManager] glyphRangeForBoundingRectWithoutAdditionalLayout:visibleRect inTextContainer:[self textContainer]];
|
| 542 |
|
562 |
|
| 543 |
if(!visibleRange.length) return;
|
563 |
if(!visibleRange.length) {
|
| - |
|
564 |
isSyntaxHighlighting = NO;
|
| - |
|
565 |
return;
|
| - |
|
566 |
}
|
| 544 |
|
567 |
|
| 545 |
NSInteger start = visibleRange.location - R_SYNTAX_HILITE_BIAS;
|
568 |
NSInteger start = visibleRange.location - R_SYNTAX_HILITE_BIAS;
|
| 546 |
if (start > 0)
|
569 |
if (start > 0)
|
| 547 |
while(start > 0) {
|
570 |
while(start > 0) {
|
| 548 |
if(CFStringGetCharacterAtIndex((CFStringRef)selfstr, start)=='\n')
|
571 |
if(CFStringGetCharacterAtIndex((CFStringRef)selfstr, start)=='\n')
|
| Line 568... |
Line 591... |
| 568 |
#endif
|
591 |
#endif
|
| 569 |
|
592 |
|
| 570 |
// only to be sure that nothing went wrongly
|
593 |
// only to be sure that nothing went wrongly
|
| 571 |
textRange = NSIntersectionRange(textRange, NSMakeRange(0, [theTextStorage length]));
|
594 |
textRange = NSIntersectionRange(textRange, NSMakeRange(0, [theTextStorage length]));
|
| 572 |
|
595 |
|
| 573 |
if (!textRange.length)
|
596 |
if (!textRange.length) {
|
| - |
|
597 |
isSyntaxHighlighting = NO;
|
| 574 |
return;
|
598 |
return;
|
| 575 |
isSyntaxHighlighting = YES;
|
599 |
}
|
| - |
|
600 |
|
| 576 |
[theTextStorage beginEditing];
|
601 |
[theTextStorage beginEditing];
|
| 577 |
|
602 |
|
| 578 |
NSColor *tokenColor = nil;
|
603 |
NSColor *tokenColor = nil;
|
| 579 |
|
604 |
|
| 580 |
size_t tokenEnd, token;
|
605 |
size_t tokenEnd, token;
|
| Line 659... |
Line 684... |
| 659 |
}
|
684 |
}
|
| 660 |
|
685 |
|
| 661 |
[theTextStorage endEditing];
|
686 |
[theTextStorage endEditing];
|
| 662 |
isSyntaxHighlighting = NO;
|
687 |
isSyntaxHighlighting = NO;
|
| 663 |
|
688 |
|
| - |
|
689 |
[self setNeedsDisplay:YES];
|
| - |
|
690 |
|
| 664 |
}
|
691 |
}
|
| 665 |
|
692 |
|
| 666 |
-(void)resetHighlights
|
693 |
-(void)resetHighlights
|
| 667 |
{
|
694 |
{
|
| 668 |
SLog(@"RScriptEditorTextView: resetHighlights with current highlite %d", currentHighlight);
|
695 |
SLog(@"RScriptEditorTextView: resetHighlights with current highlite %d", currentHighlight);
|
| Line 713... |
Line 740... |
| 713 |
*/
|
740 |
*/
|
| 714 |
- (void)boundsDidChangeNotification:(NSNotification *)notification
|
741 |
- (void)boundsDidChangeNotification:(NSNotification *)notification
|
| 715 |
{
|
742 |
{
|
| 716 |
|
743 |
|
| 717 |
if(startListeningToBoundChanges) {
|
744 |
if(startListeningToBoundChanges) {
|
| - |
|
745 |
|
| 718 |
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
746 |
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
| 719 |
selector:@selector(doSyntaxHighlighting)
|
747 |
selector:@selector(doSyntaxHighlighting)
|
| 720 |
object:nil];
|
748 |
object:nil];
|
| 721 |
|
749 |
|
| 722 |
if(![theTextStorage changeInLength] && ![self selectedRange].length) {
|
750 |
if(![theTextStorage changeInLength]) {
|
| 723 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.05];
|
751 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.05];
|
| 724 |
|
- |
|
| 725 |
}
|
752 |
}
|
| - |
|
753 |
|
| 726 |
}
|
754 |
}
|
| 727 |
|
755 |
|
| 728 |
}
|
756 |
}
|
| 729 |
|
757 |
|
| 730 |
#pragma mark -
|
758 |
#pragma mark -
|