Fix bug 295522: when inserting autocomplete results into the url bar, skip the protocol when trying to figure out where the match is. r=pink.

This commit is contained in:
smfr%smfr.org 2005-05-26 16:28:05 +00:00
Родитель 495c01f9c8
Коммит eb05dfc69a
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -572,7 +572,14 @@ NS_IMPL_ISUPPORTS1(AutoCompleteListener, nsIAutoCompleteListener)
// makes while allowing them to continue typing w/out having to
// reset the insertion point.
NSString *result = [mDataSource resultString:aRow column:@"col1"];
NSRange matchRange = [result rangeOfString:mSearchString];
// don't match letters in the protocol
int protocolLength = 0;
NSURL* resultURL = [NSURL URLWithString:result];
if (resultURL)
protocolLength = [[resultURL scheme] length];
NSRange matchRange = [result rangeOfString:mSearchString options:NSCaseInsensitiveSearch range:NSMakeRange(protocolLength, [result length] - protocolLength)];
if (matchRange.length > 0 && matchRange.location != NSNotFound) {
unsigned int location = matchRange.location + matchRange.length;
result = [result substringWithRange:NSMakeRange(location, [result length]-location)];