mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Add an auxiliary method to NSUndoManager to support coalescing undo
operations in NSTextView. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29163 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6797a06652
commit
37b81067e9
2 changed files with 42 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2009-12-23 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSUndoManager.m (_canCoalesceUndoWithTarget:selector:object):
|
||||||
|
Auxiliary method to support coalescing undo operations in
|
||||||
|
NSTextView.
|
||||||
|
|
||||||
2009-12-22 17:15-EST Gregory John Casamento <greg.casamento@gmail.com>
|
2009-12-22 17:15-EST Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
* Source/NSObject.m: Conditionally compile weak attribute for
|
* Source/NSObject.m: Conditionally compile weak attribute for
|
||||||
|
|
|
@ -1067,3 +1067,39 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Category with auxiliary method to support coalescing undo actions
|
||||||
|
* for typing events in NSTextView. However, the implementation is
|
||||||
|
* not restricted to that purpose.
|
||||||
|
*/
|
||||||
|
@interface NSUndoManager(UndoCoalescing)
|
||||||
|
- (BOOL) _canCoalesceUndoWithTarget: (id)target
|
||||||
|
selector: (SEL)aSelector
|
||||||
|
object: (id)anObject;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation NSUndoManager(UndoCoalescing)
|
||||||
|
- (BOOL) _canCoalesceUndoWithTarget: (id)target
|
||||||
|
selector: (SEL)aSelector
|
||||||
|
object: (id)anObject
|
||||||
|
{
|
||||||
|
if (_isUndoing == NO && _isRedoing == NO && [_undoStack count] > 0)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
NSArray *a = [[_undoStack lastObject] actions];
|
||||||
|
|
||||||
|
for (i = 0; i < [a count]; i++)
|
||||||
|
{
|
||||||
|
NSInvocation *inv = [a objectAtIndex: i];
|
||||||
|
if ([inv target] == target && [inv selector] == aSelector)
|
||||||
|
{
|
||||||
|
id object;
|
||||||
|
[inv getArgument: &object atIndex: 2];
|
||||||
|
if (object == anObject)
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue