Another NSText... problem: a sticky attribute
Another NSText... problem: a sticky attribute
- Subject: Another NSText... problem: a sticky attribute
- From: Ondra Cada <email@hidden>
- Date: Thu, 6 May 2004 01:23:22 +0200
Hello,
may I please ask for a help with another problem? The following code
NSTextView *textView=...
NSRange sel=[textView selectedRange];
NSTextStorage *ts=[textView textStorage];
// add a space to the end of the selection
sel.location+=sel.length; sel.length=0;
[textView replaceCharactersInRange:sel withString:@" "];
// set the insertion point after it
[textView setSelectedRange:NSMakeRange(sel.location+1,0)];
sel.length=1; // now 'sel' is the newly added space
// remove the link attribute from there
[ts removeAttribute:NSLinkAttributeName range:sel];
works all right in the sense that the space does not have the link
attribute, but if I begin typing into the text view after this code is
performed, the typed text *does* have the link attribute! To get rid of
it I have to press the left arrow, the right arrow, and then type.
I've checked both NSTextView/NSText and NSTextStorage for some methods
which would control this "empty selection temporary attribute" (or what
is the proper way to call it), but found nothing. May I please ask for
a pointer where this is documented, or at least an advice how to change
the above code so that, when typing into the text view, the newly typed
text does *not* have the link attribute?
Thanks a very big lot,
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.