From debc98eb182d845e4ab803c1cd1d84908da745d3 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 31 Aug 2011 01:23:29 +0000 Subject: - Clean up undo manager handling - Implement an undo manager per tab (strictly speaking, per connection 'document'), addressing Issue #1109. --- Source/SPWindow.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Source/SPWindow.m') diff --git a/Source/SPWindow.m b/Source/SPWindow.m index 414d043a..2f5cf56e 100644 --- a/Source/SPWindow.m +++ b/Source/SPWindow.m @@ -115,5 +115,19 @@ [super sendEvent:theEvent]; } +/** + * If this window is controlled by an SPWindowController, and thus supports being asked + * for the frontmost SPTableDocument, request the undoController for that table + * document. This allows undo to be individual per tab rather than shared across the + * window. + */ +- (NSUndoManager *)undoManager +{ + if ([[self windowController] respondsToSelector:@selector(selectedTableDocument)]) { + NSLog(@"Test: %@", [[[[self windowController] selectedTableDocument] undoManager] description]); + return [[[self windowController] selectedTableDocument] undoManager]; + } + return [super undoManager]; +} @end -- cgit v1.2.3