Community
Participate
Working Groups
I20091217-0819 Cocoa Follow-up to bug 273354, see that bug and attachment in bug 273354 comment 0 for steps to reproduce. The FF no longer makes the following lines right-aligned, but it makes the lines after the FF move upwards by one when the caret is moved to after the FF. The effect can more easily be seen when you select characters with Shift+Arrow_Right.
*** Bug 325052 has been marked as a duplicate of this bug. ***
This is also visible in java.io.PrintStream#println() from "1.6.0_20-b02-279" (default VM on my system). The bad character is just before that method.
Scott, do you know anything about this problem ?
I did some searching on NSFormFeedCharacter and found this post: http://www.cocoabuilder.com/archive/cocoa/184477-dynamically-sized-text-container.html which hints that NSLayoutManager (and eventually, NSTypesetter) treats a form feed as a page break. The method actionForControlCharacter was mentioned: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTypesetter_Class/Reference/Reference.html#//apple_ref/occ/instm/NSTypesetter/actionForControlCharacterAtIndex: Can you override the typesetter to return NSTypesetterLineBreakAction when you have a form feed or line feed?
(In reply to comment #6) > http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTypesetter_Class/Reference/Reference.html#//apple_ref/occ/instm/NSTypesetter/actionForControlCharacterAtIndex: > > Can you override the typesetter to return NSTypesetterLineBreakAction when you > have a form feed or line feed? I did some work with this yesterday -- I'll attach my work in progress. In TextLayout, if I make an NSATSTypesetter subclass and override actionForControlCharacterAtIndex: to return NSTypesetterZeroAdvancementAction the bug described here goes away, but then the entire view is shifted over to the right about 40 characters. I didn't try applying the same typesetter to all of the places we use NSLayoutManager; that's probably needed too.
Created attachment 179130 [details] partial patch Patch for TextLayout. OS.java and the bridgesupport files have a lot of other stuff from other work I'm doing.
Bizarrely enough, this web page: http://rosscarter.com/category/cocoa/page/2 and Apple's TextSizingExample gives me a much simpler solution. Typically the max size of a text container should be 1.0e7, but there are some circumstances under which even that is too big, and text will no longer lay out correctly. Setting the text container size to 0.5e7 instead of Float.MAX_VALUE fixes the problem completely, without additional overriding.
Created attachment 179348 [details] Fix Applied the described change to all places we create an NSTextContainer.
Fixed > 20100921.