aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-01-13 16:28:24 +0000
committerBibiko <bibiko@eva.mpg.de>2010-01-13 16:28:24 +0000
commit6395ddc26e0d2c3fde5b26568b70a390e4b5f152 (patch)
treef3db8d0d49c078504e2758dcd0e1a8f17c2a1b47 /Source/CMTextView.m
parent79c5e1f2d102ffa9d5121ee1f32aee8ca00c2a72 (diff)
downloadsequelpro-6395ddc26e0d2c3fde5b26568b70a390e4b5f152.tar.gz
sequelpro-6395ddc26e0d2c3fde5b26568b70a390e4b5f152.tar.bz2
sequelpro-6395ddc26e0d2c3fde5b26568b70a390e4b5f152.zip
• F5 compeltion
- fixed issues if no db is selected - trial: ⇧↩ inserts the entire path db.table or db.table.field; if invoked inside of backticks backticked
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m12
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 96c3837e..1359b8d8 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -221,7 +221,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"tableName"] != nil)
currentTable = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"tableName"];
- if(aTableName == nil && aDbName == nil) {
+ if(aTableName == nil && aDbName == nil && [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"selectedDatabase"]) {
// Put current selected db at the top
currentDb = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"selectedDatabase"];
[sortedDbs removeObject:currentDb];
@@ -360,11 +360,17 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSString* currentWord = [[self string] substringWithRange:completionRange];
NSString* prefix = @"";
NSString* allow = @"_. "; // additional chars which not close the popup
+ NSString *currentDb = nil;
BOOL dbBrowseMode = NO;
BOOL backtickMode = NO;
BOOL caseInsensitive = YES;
+ if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"selectedDatabase"] != nil)
+ currentDb = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"selectedDatabase"];
+ else
+ currentDb = @"";
+
// Check if the caret is inside quotes "" or ''; if so
// return the normal word suggestion due to the spelling's settings
// plus all unique words used in the textView
@@ -374,6 +380,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if(!isDictMode) {
+
// Check if user wants to insert a db/table/field name
// currentWord == ` : user invoked completion via `|`
dbBrowseMode = ([currentWord isEqualToString:@"`"]) ? YES : NO;
@@ -537,7 +544,8 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
dbMode:dbBrowseMode
backtickMode:backtickMode
withDbName:dbName
- withTableName:tableName];
+ withTableName:tableName
+ selectedDb:currentDb];
//Get the NSPoint of the first character of the current word
NSRange range = NSMakeRange(completionRange.location,0);