CocoaDev

Edit AllPages

I’ve subclassed NSTextView to make commented lines green, I use this code

the problem lies in (void)[layoutManager lineFragmentRectForGlyphAtIndex:range.location effectiveRange:&lineGlyphRange];

ex: when i type #colorize

it shows up like this ##c#co#col#colo#color#colori#coloriz#colorize

see the problem?

tnx


Iv’e solved it when (void)[layoutManager lineFragmentRectForGlyphAtIndex:range.location effectiveRange:&lineGlyphRange]; * is called it *performs glyph generation and layout if needed.

so i used

NSRange range = [self rangeForUserTextChange]; lineCharRange = [[self string]lineRangeForRange:range];