diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-08-10 19:40:17 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-08-10 19:40:17 +0000 |
commit | c02b45604808b6ffb6c41e671f4a0595ad13741c (patch) | |
tree | 81c1d5df75865a5d2955ce7be424c33d54fae454 /Source/SPFieldEditorController.m | |
parent | 2c7f2098004f5fe90189c536affc73dfe67393e9 (diff) | |
download | sequelpro-c02b45604808b6ffb6c41e671f4a0595ad13741c.tar.gz sequelpro-c02b45604808b6ffb6c41e671f4a0595ad13741c.tar.bz2 sequelpro-c02b45604808b6ffb6c41e671f4a0595ad13741c.zip |
• added to Custom Query table editing max text length validation
• SPFieldEditorController:
- improved textViewDidChangeSelection: to eg saves to correct rendered glyph after inserting a non-base char + base char if this combination was typed as last glyph before pressing the OK button (otherwise foo¨ will be saved instead of fooü)
Diffstat (limited to 'Source/SPFieldEditorController.m')
-rw-r--r-- | Source/SPFieldEditorController.m | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 230a3861..e5fd0550 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -29,6 +29,7 @@ #import "SPDataAdditions.h" #import "QLPreviewPanel.h" #import "SPDataCellFormatter.h" +#import "RegexKitLite.h" @implementation SPFieldEditorController @@ -39,7 +40,10 @@ (void) [self window]; counter = 0; maxTextLength = 0; - + + // Used for max text length recognition if last typed char is a non-space char + editTextViewWasChanged = NO; + // Allow the user to enter cmd+return to close the edit sheet in addition to fn+return [editSheetOkButton setKeyEquivalentModifierMask:NSCommandKeyMask]; } @@ -613,6 +617,12 @@ int newLength; + // Auxilary to ensure that eg textViewDidChangeSelection: + // saves a non-space char + base char if that combination + // occurs at the end of a sequence of typing before saving + // (OK button). + editTextViewWasChanged = ([replacementString length] == 1); + // Pure attribute changes are ok. if (!replacementString) return YES; @@ -647,7 +657,7 @@ { // Do nothing if user really didn't changed text (e.g. for font size changing return) - if(editSheetWillBeInitialized || ([[[notification object] textStorage] changeInLength]==0)) + if(!editTextViewWasChanged && (editSheetWillBeInitialized || ([[[notification object] textStorage] changeInLength]==0))) return; // clear the image and hex (since i doubt someone can "type" a gif) |