aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-05-25 16:01:48 +0000
committerBibiko <bibiko@eva.mpg.de>2009-05-25 16:01:48 +0000
commit3cf01ebabf08ed5547f657869e4f453f6cb3f65a (patch)
tree78873c11ebf2d06b451ac5fbb19747e50e73bcc2
parent6c97955139cc9dd158e600113af5cff838aa24b7 (diff)
downloadsequelpro-3cf01ebabf08ed5547f657869e4f453f6cb3f65a.tar.gz
sequelpro-3cf01ebabf08ed5547f657869e4f453f6cb3f65a.tar.bz2
sequelpro-3cf01ebabf08ed5547f657869e4f453f6cb3f65a.zip
• improved narrow-down completion
- if suggestion list contains a space add a space to the allowed textual input characters if not a space closes the pull-down list - some minor fine-tuning
-rw-r--r--Source/CMTextView.m2
-rw-r--r--Source/SPNarrowDownCompletion.m24
2 files changed, 17 insertions, 9 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index f2b80a16..c147678a 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -237,7 +237,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSString* filter = [[self string] substringWithRange:[self getRangeForCurrentWord]];
NSString* prefix = @"";
- NSString* allow = @" _."; // additional chars which not close the popup
+ NSString* allow = @"_."; // additional chars which not close the popup
BOOL caseInsensitive = YES;
SPNarrowDownCompletion* completionPopUp = [[SPNarrowDownCompletion alloc] initWithItems:[self suggestionsForSQLCompletionWith:filter dictMode:isDictMode]
diff --git a/Source/SPNarrowDownCompletion.m b/Source/SPNarrowDownCompletion.m
index 4f54924e..cce6341a 100644
--- a/Source/SPNarrowDownCompletion.m
+++ b/Source/SPNarrowDownCompletion.m
@@ -126,9 +126,6 @@
if(aStaticPrefix)
staticPrefix = [aStaticPrefix retain];
- if(someAdditionalWordCharacters)
- [textualInputCharacters addCharactersInString:someAdditionalWordCharacters];
-
caseSensitive = isCaseSensitive;
theCharRange = initRange;
theView = aView;
@@ -140,6 +137,10 @@
suggestions = [someSuggestions retain];
words = nil;
}
+
+ if(someAdditionalWordCharacters)
+ [textualInputCharacters addCharactersInString:someAdditionalWordCharacters];
+
}
return self;
}
@@ -187,7 +188,7 @@
[theTableView setHeaderView:nil];
NSTableColumn *column = [[[NSTableColumn alloc] initWithIdentifier:@"foo"] autorelease];
- //TODO maybe in the future add an image...
+ //
[column setDataCell:[ImageAndTextCell new]];
[column setEditable:NO];
[theTableView addTableColumn:column];
@@ -259,6 +260,8 @@
float maxLen = 1;
NSString* item;
int i;
+ BOOL spaceInSuggestion = NO;
+ [textualInputCharacters removeCharactersInString:@" "];
float maxWidth = [self frame].size.width;
if([newFiltered count]>0)
{
@@ -268,10 +271,16 @@
item = [newFiltered objectAtIndex:i];
else
item = [[newFiltered objectAtIndex:i] objectForKey:@"display"];
+ // If space in suggestion add space to allowed input chars
+ if(!spaceInSuggestion && [item rangeOfString:@" "].length) {
+ [textualInputCharacters addCharactersInString:@" "];
+ spaceInSuggestion = YES;
+ }
+
if([item length]>maxLen)
maxLen = [item length];
}
- maxWidth = maxLen*18;
+ maxWidth = maxLen*16;
maxWidth = (maxWidth>340) ? 340 : maxWidth;
}
if(caretPos.y>=0 && (isAbove || caretPos.y<newHeight))
@@ -464,9 +473,8 @@
- (void)insert_text:(NSString* )aString
{
- // Register the auto-pairing for undo
- [theView shouldChangeTextInRange:theCharRange replacementString:aString];
- [theView replaceCharactersInRange:theCharRange withString:aString];
+ [theView setSelectedRange:theCharRange];
+ [theView insertText:aString];
}
- (void)completeAndInsertSnippet