Maybe, to disable layout, set the textview's textContainer to nil, then restore 
it to enable layout?

On Sep 23, 2010, at 7:54 AM, Jonathan Dann <j.p.d...@gmail.com> wrote:

> Hi all,
> 
> In our app, Kaleidoscope, I have 2 text views side-by-side. In one 
> configuration the layout of the text in each text view is dependent both on 
> regions of layout in the "sibling" text view, and the model objects which 
> represent the the insert, equal and deleted regions of the diff.
> 
> The problem I've had to continuously hack around is that NSTextView, in 
> conjunction with NSLayoutManager, is rather eager to get the text to 
> re-layout. For example, when I resize the window and need to adjust the 
> frames of both scroll views, calling -[NSTextView setFrame:] results in the 
> layout manager invalidating and ensuring layout for the newly visible 
> character range.
> 
> I'd like to know if anybody has had any experience/luck with completely 
> disabling the automatic layout that the text system does in response to these 
> changes in state?
> 
> In psuedocode, I'd like to be able to:
> 
> [(textViewA or layoutManagerA) disableLayout]
> [(textViewB or layoutManagerB) disableLayout]
> 
> // set frames, strings, and other state the text views need in order to 
> re-layout correctly
> 
> [(textViewA or layoutManagerA) enableLayout] // note that this doesn't 
> *cause* layout.
> [(textViewB or layoutManagerB) enableLayout]
> 
> [(textViewA or layoutManagerA) performLayout] // this may result in layout in 
> textViewB
> [(textViewB or layoutManagerB) performLayout] // just for completeness
> 
> If there's any combination of layout manager and text view methods to 
> override and return nil, 0, NSZeroRect etc., while I set up all the state 
> that would be great. Obviously, -[NSLayoutManager setAllowsBackgroundLayout:] 
> is a no-go as that only governs if the text system will layout when the run 
> loop is idle. My problems stem from the synchronous layout the text system 
> performs, because, from the perspective of layout, it was designed to exist 
> in isolation.
> 
> Thanks,
> 
> Jonathan_______________________________________________
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/rosscarterdev%40me.com
> 
> This email sent to rosscarter...@me.com
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to