Skip to content

Commit

Permalink
[attributedlabel] Expand link-detecting area till the tail of link-st…
Browse files Browse the repository at this point in the history
…ring since CTLineGetStringIndexForPosition returns incremented index on the right half side of the character.
  • Loading branch information
inamiy committed Dec 4, 2012
1 parent f533a28 commit 860f971
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/attributedlabel/src/NIAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,8 @@ - (NSTextCheckingResult *)linkAtIndex:(CFIndex)i {
[self detectLinks];

for (NSTextCheckingResult* result in self.detectedlinkLocations) {
if (NSLocationInRange(i, result.range)) {
NSRange widerRange = NSMakeRange(result.range.location, result.range.length+1);
if (NSLocationInRange(i, widerRange)) {
foundResult = result;
break;
}
Expand All @@ -714,7 +715,8 @@ - (NSTextCheckingResult *)linkAtIndex:(CFIndex)i {

if (nil == foundResult) {
for (NSTextCheckingResult* result in self.explicitLinkLocations) {
if (NSLocationInRange(i, result.range)) {
NSRange widerRange = NSMakeRange(result.range.location, result.range.length+1);
if (NSLocationInRange(i, widerRange)) {
foundResult = result;
break;
}
Expand Down

0 comments on commit 860f971

Please sign in to comment.