On 14 Apr 2015, at 8:39 pm, Mark Wright <blue.bucon...@virgin.net> wrote: > > It would seem that in both your cases NSTextView should be fully aware of all > this by itself. Perhaps the problem is in switching the NSTextStorage out > without notifying the text view of the change? Are you swapping the > textStorage instance completely? Perhaps changing it’s content and wrapping > with editing calls would work? : > > [textStorage beginEditing]; > [textStorage setAttributedString:theNewAttributedString]; > [textStorage endEditing]; > > Maybe there’s another way to inform the parent textView that it’s content has > been changed.
FWIW, the above make no difference here. > > Shane, in your case I agree, -noteClientStringWillChange sounds like exactly > the method that’s needed. I can’t see how to get to the textView’s > textFinder either. You can get to the *findBar* with [[self.textView > enclosingScrollView] findBarView] but that’s just an NSView and likely to not > be helpful. If you’re not creating your own textFinder (and it seems from > Martin’s experience that even if you do it doesn’t work) then the only thing > I can think of is to somehow notify the textView that its content has changed > and hope and presume that it has an internal mechanism for also notifying its > textFinder. I implemented my own text finder and used -noteClientStringWillChange, and still no luck. What *seems* to be working is to disable incremental searching first, changing the text, then enabling it again. I use this elsewhere to get around another bug with text finder, at someone from Apple's suggestion. Depending on the state of the text finder at the time, it behaves a little differently for the first subsequent search, but that's a relatively small price to pay. It seems a lot of overhead for each time I modify the text, so maybe there's some way I can test if a search is active first. -- Shane Stanley <sstan...@myriad-com.com.au> <www.macosxautomation.com/applescript/apps/> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com