Re: NSTextView's "Replace All" issues
Re: NSTextView's "Replace All" issues
- Subject: Re: NSTextView's "Replace All" issues
- From: Keith Blount <email@hidden>
- Date: Thu, 6 Jul 2006 03:57:50 -0700 (PDT)
Hi Todd,
Yes, I saw your post on this a few weeks back, but I
didn't have a solution, especially given our different
approaches. My own issue is slightly different in that
I'm not getting out of bounds errors; instead, Replace
All just doesn't work at all for chunks of text that
cross document boundaries, because the private replace
all methods make a union of all the replacement ranges
and my implementation prevents edits across such
ranges.
I have come to the same conclusion as yourself, but I
have made the decision that I will just implement my
own Find panel, which I've done before and isn't too
difficult thanks to the TextFinder code being
available on Andrew Stone's website. If you like, I'll
send you my find panel when it's done (though it will
probably be a couple of weeks before I get around to
implementing it).
All the best,
Keith
--- Todd Ransom <email@hidden> wrote:
> 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 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