From 08fb692301568e7143271ffad9bbcb3a5b247de5 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 13 Jan 2010 20:53:39 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20several=20sheetDidEnd=20selectors?= =?UTF-8?q?=20to=20close=20a=20NSAlert=20or=20NSWindow=20properly=20to=20a?= =?UTF-8?q?void=20overlapping=20sheets=20=E2=80=A2=20F5=20completion=20-?= =?UTF-8?q?=20if=20a=20table=20is=20selected=20and=20no=20further=20parsin?= =?UTF-8?q?g=20info=20is=20given=20show=20that=20table=20and=20its=20field?= =?UTF-8?q?s=20at=20the=20top=20of=20the=20suggestions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMTextView.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Source/CMTextView.m') diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 1359b8d8..06ada98e 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -216,6 +216,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSString *currentDb = nil; NSString *currentTable = nil; + if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"selectedDatabase"] != nil) currentDb = [[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKeyPath:@"selectedDatabase"]; if ([[[[self window] delegate] valueForKeyPath:@"tablesListInstance"] valueForKey:@"tableName"] != nil) @@ -257,12 +258,18 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) for(id db in sortedDbs) { NSArray *allTables = [[dbs objectForKey:db] allKeys]; - NSArray *sortedTables; + NSMutableArray *sortedTables = [NSMutableArray array]; if(aTableNameExists) { - sortedTables = [NSArray arrayWithObject:aTableName]; + [sortedTables addObject:aTableName]; } else { [possibleCompletions addObject:[NSDictionary dictionaryWithObjectsAndKeys:db, @"display", @"database-small", @"image", nil]]; - sortedTables= [allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + [sortedTables addObjectsFromArray:[allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]]; + // if(aDbName == nil && aTableName) { + if([sortedTables count] > 1 && [sortedTables containsObject:currentTable]) { + [sortedTables removeObject:currentTable]; + [sortedTables insertObject:currentTable atIndex:0]; + } + // } } for(id table in sortedTables) { NSDictionary * theTable = [[dbs objectForKey:db] objectForKey:table]; -- cgit v1.2.3