mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-24 06:28:54 +00:00
Fixed bugs in replaceLayoutManager:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14672 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2cab5b1dd2
commit
82656d0255
1 changed files with 8 additions and 3 deletions
|
@ -122,27 +122,32 @@
|
|||
return _layoutManager;
|
||||
}
|
||||
|
||||
- (void) replaceLayoutManager: (NSLayoutManager*)newLayoutManager
|
||||
- (void) replaceLayoutManager: (NSLayoutManager *)newLayoutManager
|
||||
{
|
||||
if (newLayoutManager != _layoutManager)
|
||||
{
|
||||
id textStorage = [_layoutManager textStorage];
|
||||
NSArray *textContainers = [_layoutManager textContainers];
|
||||
unsigned i, count = [textContainers count];
|
||||
id oldLayoutManager = _layoutManager;
|
||||
|
||||
RETAIN (oldLayoutManager);
|
||||
[textStorage removeLayoutManager: _layoutManager];
|
||||
[textStorage addLayoutManager: newLayoutManager];
|
||||
[_layoutManager setTextStorage: nil];
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
NSTextContainer *container;
|
||||
NSTextContainer *container;
|
||||
|
||||
container = RETAIN ([textContainers objectAtIndex: i]);
|
||||
[_layoutManager removeTextContainerAtIndex: i];
|
||||
[newLayoutManager addTextContainer: container];
|
||||
/* The textview is caching the layout manager; refresh the
|
||||
* cache with this do-nothing call. */
|
||||
[[container textView] setTextContainer: container];
|
||||
RELEASE (container);
|
||||
}
|
||||
RELEASE (oldLayoutManager);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue