From 507d0089c6bb73a01129f1e356d1e88ca53afb55 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 16 Oct 2009 12:30:38 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20three=20further=20typos=20for:=20?= =?UTF-8?q?=20=20=20objectForKey:@"NullValue"=20=E2=80=A2=20allow=20to=20e?= =?UTF-8?q?nter=20the=20NULL=20value=20string=20even=20if=20the=20cell/fie?= =?UTF-8?q?ld's=20maximal=20length=20is=20set=20to=20less=20then=20the=20a?= =?UTF-8?q?ctual=20NULL=20value=20string=20length=20(eg=20varchar(3)=20and?= =?UTF-8?q?=20NULL=20value=20string=20is=20@"NULL")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPFieldEditorController.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Source/SPFieldEditorController.m') diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index bdb78726..83a63d6b 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -346,10 +346,10 @@ editSheetReturnCode = 0; // Validate the sheet data before saving them. - // - for max text length select the part which won't be saved + // - for max text length (except for NULL value string) select the part which won't be saved // and suppress closing the sheet if(sender == editSheetOkButton) { - if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength) { + if (maxTextLength > 0 && [[editTextView textStorage] length] > maxTextLength && ![[[editTextView textStorage] string] isEqualToString:[prefs objectForKey:@"NullValue"]]) { [editTextView setSelectedRange:NSMakeRange(maxTextLength, [[editTextView textStorage] length] - maxTextLength)]; [editTextView scrollRangeToVisible:NSMakeRange([editTextView selectedRange].location,0)]; [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Text is too long. Maximum text length is set to %d.", @"Text is too long. Maximum text length is set to %d."), maxTextLength]]; @@ -833,11 +833,13 @@ #pragma mark Delegates /* - Validate editTextView for max text length + Validate editTextView for max text length except for NULL value string */ - (BOOL)textView:(NSTextView *)textView shouldChangeTextInRange:(NSRange)r replacementString:(NSString *)replacementString { - if(textView == editTextView && maxTextLength > 0) { + + if(textView == editTextView && maxTextLength > 0 + && ![ [[[editTextView textStorage] string] stringByAppendingString:replacementString] isEqualToString:[prefs objectForKey:@"NullValue"]]) { int newLength; -- cgit v1.2.3