aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFieldEditorController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-14 12:52:23 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-14 12:52:23 +0000
commitdb7399d810986569ba54ff5c83ea9c066112a33d (patch)
treea1a2d158906d6ab5821473279c2ff1c2a8cdcdae /Source/SPFieldEditorController.m
parent1fdf6898c1750fc0af72d9919cf370855f6a5bf2 (diff)
downloadsequelpro-db7399d810986569ba54ff5c83ea9c066112a33d.tar.gz
sequelpro-db7399d810986569ba54ff5c83ea9c066112a33d.tar.bz2
sequelpro-db7399d810986569ba54ff5c83ea9c066112a33d.zip
• minor changes to SPTooltip
• some work on the SPFieldEditor's undo manager (has to be continued)
Diffstat (limited to 'Source/SPFieldEditorController.m')
-rw-r--r--Source/SPFieldEditorController.m53
1 files changed, 31 insertions, 22 deletions
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index b2193b32..2c9359b7 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -213,24 +213,37 @@
int cycleCounter = 0;
for (;;) {
- cycleCounter++;
+ // cycleCounter++;
// Allow undo grouping if user typed a ' ' (for word level undo)
// or a RETURN
- if([[NSApp currentEvent] type] == NSKeyDown
- && (
- [[[NSApp currentEvent] charactersIgnoringModifiers] isEqualToString:@" "]
- || [[NSApp currentEvent] keyCode] == 36
- )
- )
- cycleCounter=100;
+ // if([[NSApp currentEvent] type] == NSKeyDown
+ // && (
+ // [[[NSApp currentEvent] charactersIgnoringModifiers] isEqualToString:@" "]
+ // || [[NSApp currentEvent] keyCode] == 36
+ // // || [[NSApp currentEvent] modifierFlags] & (NSCommandKeyMask|NSControlKeyMask|NSAlternateKeyMask)
+ // )
+ // )
+ // cycleCounter=100;
// After 5 run loops (fast writing forms longer blocks)
// or the user typed a ' ' or RETURN and the textView was changed (allowUndo)
// form an undo group
- if(cycleCounter>5 && allowUndo && ![esUndoManager isUndoing] && ![esUndoManager isRedoing]) {
- cycleCounter=0;
+
+ // Break the run loop if editSheet was closed
+ if ([NSApp runModalSession:session] != NSRunContinuesResponse
+ || ![editSheet isVisible])
+ break;
+
+ // Execute code on DefaultRunLoop (like displaying a tooltip)
+ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
+ beforeDate:[NSDate distantFuture]];
+
+ if( (wasCutPaste || allowUndo) && ![esUndoManager isUndoing] && ![esUndoManager isRedoing] ) {
+
+ cycleCounter = 0;
allowUndo = NO;
+ wasCutPaste = NO;
while([esUndoManager groupingLevel] > 0) {
[esUndoManager endUndoGrouping];
cycleCounter++;
@@ -239,16 +252,8 @@
[esUndoManager beginUndoGrouping];
cycleCounter = 0;
- }
- // Break the run loop if editSheet was closed
- if ([NSApp runModalSession:session] != NSRunContinuesResponse
- || ![editSheet isVisible])
- break;
-
- // Execute code on DefaultRunLoop (like displaying a tooltip)
- [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
- beforeDate:[NSDate distantFuture]];
+ }
}
[NSApp endModalSession:session];
@@ -272,6 +277,11 @@
return esUndoManager;
}
+- (void)setWasCutPaste
+{
+ wasCutPaste = YES;
+}
+
- (IBAction)closeEditSheet:(id)sender
{
@@ -775,7 +785,8 @@
}
-// TextView delegate methods
+#pragma -
+#pragma TextView delegate methods
/**
* Traps enter and return key and closes editSheet instead of inserting a linebreak when user hits return.
@@ -789,8 +800,6 @@
[self closeEditSheet:editSheetOkButton];
return YES;
}
- else
- return NO;
}
return NO;
}