caret location

View: New views
4 Messages — Rating Filter:   Alert me  

caret location

by Kirt Fitzpatrick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does anyone know how to obtain the caret location either in the line or in the file?  selectedRanges is not implemented by OakTextView.

Thanks,

kirt


_______________________________________________
textmate-plugins mailing list
textmate-plugins@...
http://lists.macromates.com/mailman/listinfo/textmate-plugins

Re: caret location

by Allan Odgaard-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8. May 2007, at 07:04, Kirt Fitzpatrick wrote:

> Does anyone know how to obtain the caret location either in the  
> line or in the file?  selectedRanges is not implemented by  
> OakTextView.

The class does not expose this via any attributes.

It does however have lineNumber and columnNumber as bindable  
properties. So in practice you can use that to get the line/column  
position.

_______________________________________________
textmate-plugins mailing list
textmate-plugins@...
http://lists.macromates.com/mailman/listinfo/textmate-plugins

Re: caret location

by Kirt Fitzpatrick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I did not find those properties as exposedBindings for OakTextView.  My test code follows:

    bindings = [responder exposedBindings];
    int i;

    for ( i=0; i < [bindings count]; i++ ) {
        NSLog( @"binding: %@", [bindings objectAtIndex:i] );
    }


This produced the following output.
    2007-05-08 09:43:51.800 TextMate[915] binding: hidden
    2007-05-08 09:43:51.800 TextMate[915] binding: toolTip



Also attempting to bind to lineNumber or columnNumber
    [self bind:@"lineNumber" toObject:responder withKeyPath:@"lineNumber" options:nil];


causes the following error
     [<OakTextView 0x630c50> valueForUndefinedKey:]: this class is not key value coding-compliant for the key lineNumber



However lineNumber and columnNumber appear to be available in OakStatusBar.  But I do not know how to grab that object.  Any ideas?

thanks again,
kirt

On 5/8/07, Allan Odgaard <throw-away-1@...> wrote:
On 8. May 2007, at 07:04, Kirt Fitzpatrick wrote:

> Does anyone know how to obtain the caret location either in the
> line or in the file?  selectedRanges is not implemented by
> OakTextView.

The class does not expose this via any attributes.

It does however have lineNumber and columnNumber as bindable
properties. So in practice you can use that to get the line/column
position.

_______________________________________________
textmate-plugins mailing list
textmate-plugins@...
http://lists.macromates.com/mailman/listinfo/textmate-plugins


_______________________________________________
textmate-plugins mailing list
textmate-plugins@...
http://lists.macromates.com/mailman/listinfo/textmate-plugins

Re: caret location

by Allan Odgaard-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 8. May 2007, at 21:12, Kirt Fitzpatrick wrote:

> [...]
> Also attempting to bind to lineNumber or columnNumber
>     [self bind:@"lineNumber" toObject:responder  
> withKeyPath:@"lineNumber" options:nil];

You need to send the bind:… message to the text view. E.g.:

     NSMutableDictionary* dict = [NSMutableDictionary dictionary];
     [textView bind:@"lineNumber"   toObject:dict  
withKeyPath:@"line"   options:nil];
     [textView bind:@"columnNumber" toObject:dict  
withKeyPath:@"column" options:nil];

     NSLog(@"%@", dict);

     // cleanup
     [textView unbind:@"lineNumber"];
     [textView unbind:@"columnNumber"];





_______________________________________________
textmate-plugins mailing list
textmate-plugins@...
http://lists.macromates.com/mailman/listinfo/textmate-plugins