aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPNarrowDownCompletion.m
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 /Source/SPNarrowDownCompletion.m
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
Diffstat (limited to 'Source/SPNarrowDownCompletion.m')
-rw-r--r--Source/SPNarrowDownCompletion.m24
1 files changed, 16 insertions, 8 deletions
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