get selected range of selection

This commit is contained in:
Riccardo Mottola 2021-08-04 01:42:08 +02:00
parent f9d8e56a2e
commit 18136e7678

View file

@ -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