• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSFindAndReplace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSFindAndReplace


  • Subject: Re: NSFindAndReplace
  • From: Ali Ozer <email@hidden>
  • Date: Tue, 27 Jun 2006 19:08:20 -0700

This method simply goes through NSTextStorage's replaceCharactersInRange:withAttributedString:, which for a subclass of NSTextStorage would go through NSTextStorage's primitives (replaceCharactersInRange:withString: and setAttributes:range:). Your subclass should be seeing multiple calls to these primitives, with nothing private going on.

As you've observed, in some cases it does replace vast ranges. I don't believe there are any bugs reported against it. If you are seeing wrong calls, please submit a bug.

Of course please don't count on these behaviors, and in fact, the implementation has changed significantly post-Tiger.

Ali



Begin forwarded message:

From: Todd Ransom <email@hidden>
Date: June 27, 2006 12:36:43 PM PDT
To: cocoa-dev <email@hidden>
Subject: NSFindAndReplace

I have a text storage subclass that takes an array of text storage objects and makes them appear as a single text storage object. This works very well for the most part, but I recently had a report from a user that "Replace All" in the Find panel was hanging the app. So, after a little digging, I found that the following method is not working properly for my text storage:

[NSTextStorage(NSFindAndReplace) replaceString:withString:ranges:options:inView:replacementRange:]

It is replacing vast sections of text (which may be an optimization) and in some cases it is replacing the wrong sections of text.

I can't find any documentation on this method so I am wondering what the best course of action is. Obviously I could override this method to make it work, but since it is a private, undocumented method I am hesitant to do that. Is there somewhere else in my text storage class I should be looking to make this work properly

Todd Ransom
Return Self Software
http://returnself.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


References: 
 >NSFindAndReplace (From: Todd Ransom <email@hidden>)

  • Prev by Date: using NSURLConnection to get only the HTTP header
  • Next by Date: Re: using NSURLConnection to get only the HTTP header
  • Previous by thread: NSFindAndReplace
  • Next by thread: Arbitrary polygons crash -[NSBezierPath stroke]
  • Index(es):
    • Date
    • Thread