Apply nsundomanager patch from wolfgang lux

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/stable@25524 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-10-11 08:00:25 +00:00
parent 879147b7c2
commit 29cc64eb05
2 changed files with 33 additions and 21 deletions

View file

@ -1,3 +1,14 @@
2007-10-11 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSUndoManager: Prevent incorrect posting of notifications
during undo/redo and avoid unnecessary creation of undo groups.
2007-10-10 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSDecimal.m (NSDecimalMultiplyByPowerOf10): Move check of
over/underflow after copy.
Patch by Mark Tracy <tracy454@concentric.net>.
2007-10-03 Richard Frith-Macdonald <rfm@gnu.org> 2007-10-03 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSData.m: Fix ([-classForCoder:]) to return base class of * Source/NSData.m: Fix ([-classForCoder:]) to return base class of

View file

@ -162,13 +162,9 @@
@implementation NSUndoManager (Private) @implementation NSUndoManager (Private)
- (void) _loop: (id)arg - (void) _loop: (id)arg
{ {
if (_groupsByEvent) if (_groupsByEvent && _group != nil)
{ {
if (_group != nil) [self endUndoGrouping];
{
[self endUndoGrouping];
}
[self beginUndoGrouping];
} }
_runLoopGroupingPending = NO; _runLoopGroupingPending = NO;
} }
@ -218,9 +214,10 @@
{ {
RELEASE(parent); RELEASE(parent);
[[NSNotificationCenter defaultCenter] if (_isUndoing == NO && _isRedoing == NO)
postNotificationName: NSUndoManagerDidOpenUndoGroupNotification [[NSNotificationCenter defaultCenter]
object: self]; postNotificationName: NSUndoManagerDidOpenUndoGroupNotification
object: self];
} }
} }
@ -334,9 +331,10 @@
p = RETAIN([g parent]); p = RETAIN([g parent]);
_group = p; _group = p;
[g orphan]; [g orphan];
[[NSNotificationCenter defaultCenter] if (_isUndoing == NO && _isRedoing == NO)
postNotificationName: NSUndoManagerWillCloseUndoGroupNotification [[NSNotificationCenter defaultCenter]
object: self]; postNotificationName: NSUndoManagerWillCloseUndoGroupNotification
object: self];
if (p == nil) if (p == nil)
{ {
if (_isUndoing) if (_isUndoing)
@ -882,15 +880,18 @@
if (_modes != newModes) if (_modes != newModes)
{ {
ASSIGN(_modes, newModes); ASSIGN(_modes, newModes);
[[NSRunLoop currentRunLoop] cancelPerformSelector: @selector(_loop:) if (_runLoopGroupingPending)
target: self {
argument: nil]; NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
[[NSRunLoop currentRunLoop] performSelector: @selector(_loop:) [runLoop cancelPerformSelector: @selector(_loop:)
target: self target: self
argument: nil argument: nil];
order: NSUndoCloseGroupingRunLoopOrdering [runLoop performSelector: @selector(_loop:)
modes: _modes]; target: self
_runLoopGroupingPending = YES; argument: nil
order: NSUndoCloseGroupingRunLoopOrdering
modes: _modes];
}
} }
} }