aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-06-22 00:45:31 +0000
committerrowanbeentje <rowan@beent.je>2012-06-22 00:45:31 +0000
commit756f01cc734ba7603f7e24bce8102bb360e6f56d (patch)
treeeb29fca9f6780d3e6c929dc89a8e277a279a9877 /Source
parentfcf1e1e527e35c824449f40289a799c809c9a1a4 (diff)
downloadsequelpro-756f01cc734ba7603f7e24bce8102bb360e6f56d.tar.gz
sequelpro-756f01cc734ba7603f7e24bce8102bb360e6f56d.tar.bz2
sequelpro-756f01cc734ba7603f7e24bce8102bb360e6f56d.zip
- Improve help search updates while typing, adding basic display for no results found and showing the table of contents if the field is cleared
- Permit help searches for the operator "%" as a standalone string - Update localisable strings
Diffstat (limited to 'Source')
-rw-r--r--Source/SPCustomQuery.m16
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 0bb182dd..e62c6c44 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -2791,7 +2791,12 @@
*/
- (void)showHelpFor:(NSString *)searchString addToHistory:(BOOL)addToHistory calledByAutoHelp:(BOOL)autoHelp
{
- if(![searchString length]) return;
+
+ // If there's no search string, show nothing if called by autohelp, and the index otherwise
+ if (![searchString length]) {
+ if (autoHelp) return;
+ searchString = SP_HELP_TOC_SEARCH_STRING;
+ }
NSString *helpString = [self getHTMLformattedMySQLHelpFor:searchString calledByAutoHelp:autoHelp];
@@ -3044,6 +3049,9 @@
if(![searchString length]) return @"";
+ // Don't escape % when being used as a wildcard, but escape it when it's being used by itself.
+ if ([searchString isEqualToString:@"%"]) searchString = @"\\%";
+
NSRange aRange;
SPMySQLResult *theResult = nil;
NSDictionary *tableDetails;
@@ -3071,8 +3079,8 @@
theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"HELP '%@%%'", [searchString stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]]];
// really nothing found?
- if(![theResult numberOfRows])
- return @"";
+ if (![theResult numberOfRows])
+ return [NSString stringWithFormat:@"<em style='color: gray'>%@</em>", NSLocalizedString(@"No results found.", @"No results found for a help search")];
}
// Ensure rows are returned as strings to prevent data problems with older 4.1 servers
@@ -3128,8 +3136,6 @@
}
} else { // list all found topics
- NSUInteger r = (NSUInteger)[theResult numberOfRows];
- if (r) [theResult seekToRow:0];
// check if HELP 'contents' is called
if(![searchString isEqualToString:SP_HELP_TOC_SEARCH_STRING])