mirror of
https://github.com/gnustep/apps-projectcenter.git
synced 2025-03-17 08:01:24 +00:00
get selected range of selection
This commit is contained in:
parent
f9d8e56a2e
commit
18136e7678
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue