| Line 140... |
Line 140... |
| 140 |
prefs = [[NSUserDefaults standardUserDefaults] retain];
|
140 |
prefs = [[NSUserDefaults standardUserDefaults] retain];
|
| 141 |
[[Preferences sharedPreferences] addDependent:self];
|
141 |
[[Preferences sharedPreferences] addDependent:self];
|
| 142 |
|
142 |
|
| 143 |
lineNumberingEnabled = [Preferences flagForKey:showLineNumbersKey withDefault:NO];
|
143 |
lineNumberingEnabled = [Preferences flagForKey:showLineNumbersKey withDefault:NO];
|
| 144 |
|
144 |
|
| - |
|
145 |
// Init textStorage and set self as delegate for the textView's textStorage to enable
|
| - |
|
146 |
// syntax highlighting, folding etc.
|
| 145 |
theTextStorage = [[RScriptEditorTextStorage alloc] init];
|
147 |
theTextStorage = [[RScriptEditorTextStorage alloc] initWithDelegate:self];
|
| 146 |
|
148 |
|
| 147 |
// Set self as delegate for the textView's textStorage to enable syntax highlighting,
|
- |
|
| 148 |
[theTextStorage setDelegate:self];
|
- |
|
| 149 |
_foldedImp = [theTextStorage methodForSelector:_foldedSel];
|
149 |
_foldedImp = [theTextStorage methodForSelector:_foldedSel];
|
| 150 |
|
150 |
|
| 151 |
// Make sure using foldingLayoutManager
|
151 |
// Make sure using foldingLayoutManager
|
| 152 |
if (![[self layoutManager] isKindOfClass:[RScriptEditorLayoutManager class]]) {
|
152 |
if (![[self layoutManager] isKindOfClass:[RScriptEditorLayoutManager class]]) {
|
| 153 |
RScriptEditorLayoutManager *layoutManager = [[RScriptEditorLayoutManager alloc] init];
|
153 |
RScriptEditorLayoutManager *layoutManager = [[RScriptEditorLayoutManager alloc] init];
|
| Line 1283... |
Line 1283... |
| 1283 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.01f];
|
1283 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.01f];
|
| 1284 |
}
|
1284 |
}
|
| 1285 |
|
1285 |
|
| 1286 |
- (void)refoldLinesInRange:(NSRange)range
|
1286 |
- (void)refoldLinesInRange:(NSRange)range
|
| 1287 |
{
|
1287 |
{
|
| - |
|
1288 |
|
| 1288 |
NSInteger foldId = [theTextStorage registerFoldedRange:range];
|
1289 |
NSInteger foldId = [theTextStorage registerFoldedRange:range];
|
| 1289 |
|
1290 |
|
| 1290 |
if(foldId < 0) {
|
1291 |
if(foldId < 0) {
|
| 1291 |
[RTooltip showWithObject:NLS(@"Maximum number of folded code fragments is reached.") atLocation:[NSEvent mouseLocation]];
|
1292 |
[RTooltip showWithObject:NLS(@"Maximum number of folded code fragments is reached.") atLocation:[NSEvent mouseLocation]];
|
| 1292 |
return;
|
1293 |
return;
|