• 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
NSTextView insertion point doesn't reflect paragraphSpacingBefore
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView insertion point doesn't reflect paragraphSpacingBefore


  • Subject: NSTextView insertion point doesn't reflect paragraphSpacingBefore
  • From: Aram Greenman <email@hidden>
  • Date: Fri, 13 Feb 2004 11:54:09 -0800

The insertion point in an NSTextView doesn't reflect the -[NSParagraphStyle paragraphSpacingBefore] if it is at the end of the text and the current paragraph is empty. I've reported this, but in the meantime I'm trying to work around it by overriding -[NSTextView drawInsertionPointInRect:color:turnedOn:] to move to the correct rect. The problem is it doesn't work until the second "blink".


- (void)drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)turnedOn {
unsigned insertion = [self selectedRange].location;
if ((insertion == [[self string] length] && // at end of text
insertion == [[self string] paragraphRangeForRange:NSMakeRange(insertion, 0)].location) && // at start of paragraph
insertion != [[self layoutManager] characterRangeForGlyphRange:[[self layoutManager] glyphRangeForTextContainer:[self textContainer]] actualGlyphRange:NULL].location) { // not the first paragraph in this text container
rect.origin.y += [[[self typingAttributes] objectForKey:NSParagraphStyleAttributeName] paragraphSpacingBefore]; // move the insertion point
}
// call super with corrected rect
[super drawInsertionPointInRect:rect color:color turnedOn:turnedOn];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: NSAttributedString size method returning bogus data after adding NSParagraphStyle attribute
  • Next by Date: Re: static objects "autoreleased with no pool in place - just leaking"
  • Previous by thread: Re: NSAttributedString size method returning bogus data after adding NSParagraphStyle attribute
  • Next by thread: NSTableView & Drag&Drop: What dataSource, What Delegate
  • Index(es):
    • Date
    • Thread