Re: NSTextView's "Replace All" issues
Re: NSTextView's "Replace All" issues
- Subject: Re: NSTextView's "Replace All" issues
- From: Todd Ransom <email@hidden>
- Date: Wed, 5 Jul 2006 21:22:28 -0600
Keith,
I recently discovered a similar issue in my own text storage
aggregator. Although we have different approaches to the problem, it
seems we are both being bitten by the same behavior. As far as I can
tell there is no public method you can override for the "Replace All"
function in the Find panel.
I have decided my choices are to either override the private method
[NSTextStorage(NSFindAndReplace)
replaceString:withString:ranges:options:inView:replacementRange:] or
write my own find panel which will call my own method for "Replace
All." I haven't decided yet which is the better option. If anyone has
any other suggestions I would be interested in hearing them.
Todd Ransom
Return Self Software
http://returnself.com
On Jul 4, 2006, at 12:31 PM, Keith Blount wrote:
Hi,
I have an NSTextStorage subclass that is built from
several text storages and handles keeping them in
sync. All works fine. However, it somewhat relies on
NSTextView's delegate method,
-textView:shouldChangeTextInRanges:replacementStrings:,
returning NO when the user is trying to edit a range
that traverses more than one component text storage.
(This is the behaviour I want, as each component is
really a discrete document and I don't want to try to
second-guess the user's intentions in this instance.)
Unfortunately, this screws up the find panel's Replace
All action when trying to replace a word that occurs
in several components. This is because during a
Replace All operation, the text view's delegate method
is only called once, with a union of all the ranges to
be replaced (which can therefore traverse the range of
more than one component even if each individual
replacement range does not) rather than separately for
each range that is to be updated.
Does anybody know if there is any way around this?
Thanks,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden