diff --git a/Modules/Editors/ProjectCenter/PCEditor.m b/Modules/Editors/ProjectCenter/PCEditor.m index 0d087a2..119caad 100644 --- a/Modules/Editors/ProjectCenter/PCEditor.m +++ b/Modules/Editors/ProjectCenter/PCEditor.m @@ -941,6 +941,10 @@ - (void)textViewDidChangeSelection:(NSNotification *)notification { + id object; + + object = [notification object]; + if (editorTextViewIsPressingKey == NO) { id object; @@ -949,6 +953,21 @@ if (object == _intEditorView || object == _extEditorView) [self computeNewParenthesisNesting: object]; } + + // calculate current line + if ([object isKindOfClass:[NSTextView class]]) + { + NSTextView *tv = (NSTextView *)object; + NSArray *selArray; + NSRange lastSelection; + NSRange selRange; + NSUInteger selLine; + + selArray = [tv selectedRanges]; + lastSelection = [[selArray lastObject] rangeValue]; + NSLog(@"last selection is %@", [selArray lastObject]); + [[tv string] getLineStart:NULL end:&selLine contentsEnd:NULL forRange:lastSelection]; + } } - (void)editorTextViewWillPressKey:sender