aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataCellFormatter.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-08-06 01:06:27 +0000
committerrowanbeentje <rowan@beent.je>2012-08-06 01:06:27 +0000
commitbec9204f21160fe4c001df75050e5d0ec8e42a2f (patch)
treec9d5b570ed0fda96d320dd6ea4b2da850aa46f21 /Source/SPDataCellFormatter.m
parent6b79f6517a56c96c272cd4c2583f3431418385a9 (diff)
downloadsequelpro-bec9204f21160fe4c001df75050e5d0ec8e42a2f.tar.gz
sequelpro-bec9204f21160fe4c001df75050e5d0ec8e42a2f.tar.bz2
sequelpro-bec9204f21160fe4c001df75050e5d0ec8e42a2f.zip
- Add linebreak display in the database processes list, preventing display of truncated queries for clarity (Issue #1407)
- If SHOW FULL PROCESSLIST isn't on, and the query appears to be truncated (length == 100), add a trailing ellipsis to suggest more content
Diffstat (limited to 'Source/SPDataCellFormatter.m')
-rw-r--r--Source/SPDataCellFormatter.m17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/SPDataCellFormatter.m b/Source/SPDataCellFormatter.m
index 04c43b7d..951fafbc 100644
--- a/Source/SPDataCellFormatter.m
+++ b/Source/SPDataCellFormatter.m
@@ -36,13 +36,26 @@
@implementation SPDataCellFormatter
@synthesize textLimit;
+@synthesize displayLimit;
@synthesize fieldType;
+- (id)init
+{
+ if ((self = [super init])) {
+ displayLimit = NSNotFound;
+ }
+ return self;
+}
+
- (NSString *)stringForObjectValue:(id)anObject
{
// Truncate the string for speed purposes if it's very long - improves table scrolling speed.
- if ([anObject isKindOfClass:[NSString class]] && [(NSString *)anObject length] > 150) {
- return ([NSString stringWithFormat:@"%@...", [anObject substringToIndex:147]]);
+ if (displayLimit != NSNotFound && [anObject isKindOfClass:[NSString class]] && [(NSString *)anObject length] > displayLimit) {
+ return ([NSString stringWithFormat:@"%@...", [anObject substringToIndex:displayLimit - 3]]);
+ }
+
+ if (![anObject isKindOfClass:[NSString class]]) {
+ return [anObject description];
}
return anObject;