We have an NSTextView
that could possibly contains large amounts of text. I'm using it to replace an NSTableView
, which was far too slow when it was generating thousands of rows. We also have an NSSearchField
, which used to apply its predicate to the table's array controller to narrow it down to only rows containing a given string. Now I want to do the same with the text view.
I tried applying a custom attribute to the found ranges in the NSTextStorage
, then used the NSLayoutManagerDelegate
method -layoutManager:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:
to set the glyph properties of the non-marked ranges to NSGlyphPropertyNull
. This resulted in many errors:
_NSGlyphTreeGlyphRangeForCharacterRange missing glyphs 1
And it brought the app to its knees. Is there some better way to filter the display of the textStorage and only draw the paragraphs we found?
For now, it has to work on 10.10. Bleh.