зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
495c01f9c8
Коммит
eb05dfc69a
|
@ -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)];
|
||||
|
|
Загрузка…
Ссылка в новой задаче