aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 582df6c2..7d140ccb 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -32,6 +32,7 @@
#import "SPConstants.h"
#import "SPQueryController.h"
#import "SPTooltip.h"
+#import "TablesList.h"
#pragma mark -
#pragma mark lex init
@@ -1182,6 +1183,18 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"selectedDatabase"] != nil)
currentDb = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"selectedDatabase"];
+ while([theHintString isMatchedByRegex:@"(?<!\\\\)\\$SP_SELECTED_TABLES"]) {
+ r = [theHintString rangeOfRegex:@"(?<!\\\\)\\$SP_SELECTED_TABLES"];
+ if(r.length) {
+ NSArray *selTables = [[[self delegate] valueForKeyPath:@"tablesListInstance"] selectedTableNames];
+ if([selTables count])
+ [theHintString replaceCharactersInRange:r withString:[selTables componentsJoinedAndBacktickQuoted]];
+ else
+ [theHintString replaceCharactersInRange:r withString:@"<tables>"];
+ }
+ [theHintString flushCachedRegexData];
+ }
+
while([theHintString isMatchedByRegex:@"(?<!\\\\)\\$SP_SELECTED_TABLE"]) {
r = [theHintString rangeOfRegex:@"(?<!\\\\)\\$SP_SELECTED_TABLE"];
if(r.length) {