Fixed bug with URL matching

Monotone-Parent: dac2c88734449dfb2523709ee6ad66d821245e35
Monotone-Revision: d6350865052ebcebfd9ec06ba135608c73b7c53f

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-06-30T19:09:57
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2009-06-30 19:09:57 +00:00
parent e41d6dced5
commit 65452aecb9
2 changed files with 9 additions and 13 deletions
+1 -1
View File
@@ -250,7 +250,7 @@
{
currentRange = [currentRangePtr pointerValue];
if (NSLocationInRange (testRange.location, *currentRange)
|| NSLocationInRange (NSMaxRange (testRange), *currentRange))
|| NSLocationInRange (currentRange->location, testRange))
response = YES;
}
+8 -12
View File
@@ -226,17 +226,13 @@ static NSMutableCharacterSet *urlStartChars = nil;
matchRange.location = startLocation + 1;
currentUrlRange = [selfCopy _rangeOfURLInRange: matchRange];
if ([ranges hasRangeIntersection: currentUrlRange])
rest.location = NSMaxRange (currentUrlRange);
else
{
if (currentUrlRange.length > matchLength)
[newRanges addNonNSObject: &currentUrlRange
withSize: sizeof (NSRange)
copy: YES];
rest.location = NSMaxRange (currentUrlRange);
}
if (![ranges hasRangeIntersection: currentUrlRange])
if (currentUrlRange.length > matchLength)
[newRanges addNonNSObject: &currentUrlRange
withSize: sizeof (NSRange)
copy: YES];
rest.location = NSMaxRange (currentUrlRange);
length = [selfCopy length];
rest.length = length - rest.location;
matchRange = [selfCopy rangeOfString: match
@@ -258,7 +254,7 @@ static NSMutableCharacterSet *urlStartChars = nil;
offset += ([newUrlText length] - [urlText length]);
// Add range for further substitutions
currentUrlRange = NSMakeRange (currentUrlRange.location, [newUrlText length]);
currentUrlRange = NSMakeRange (rangePtr->location, [newUrlText length]);
[ranges addNonNSObject: &currentUrlRange
withSize: sizeof (NSRange)
copy: YES];