aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CustomQuery.m5
-rw-r--r--Source/SPFieldEditorController.h1
-rw-r--r--Source/SPFieldEditorController.m14
3 files changed, 18 insertions, 2 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 7153e916..10b93a31 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1723,6 +1723,11 @@
SPFieldEditorController *fieldEditor = [[SPFieldEditorController alloc] init];
+ // Set max text length
+ if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"string"]
+ && [columnDefinition valueForKey:@"char_length"])
+ [fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] intValue]];
+
id editData = [[fieldEditor editWithObject:[[fullResult objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] intValue]]
fieldName:[columnDefinition objectForKey:@"name"]
usingEncoding:[mySQLConnection encoding]
diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h
index f7b669f4..4205140f 100644
--- a/Source/SPFieldEditorController.h
+++ b/Source/SPFieldEditorController.h
@@ -50,6 +50,7 @@
int counter;
unsigned long long maxTextLength;
+ BOOL editTextViewWasChanged;
NSUserDefaults *prefs;
}
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)