More code editor...

marksibly

Registered
Hi,

I have started on a little code editor that uses an NSTextStorage delegate to modify keywords etc as they are typed into an NSTextView.

It almost works, but the cursor location changes when the text is modified by 'replaceCharactersInRange' within the delegate.

The cursor appears to be jumping to the last character in the replacement range, which is sometimes ahead of the actual 'typing' cursor location.

Is there anyway to either lock the cursor location, or read it from the NSTextStorage?

Thanks in advance for any hints.

Bye!
Mark
 
The NSTextStorage doesn't manage the selection; the NSTextView does. The methods in question are -setSelectedRange: and -selectedRange, the latter is adopted by NSTextView as part of the NSTextInput protocol.
 
Is there any way to invoke the down key, which would presumably move the cursor to the end of the line?
 
Hi,

Well, I've come up with a fairly dodgy solution to this problem-ette, but that aside, it works great!

Works faster than I expected - and is much faster (and easier!) than the same thing under Win32.

If anyone's interested, I'd be happy to post the code here.
 
Back
Top