fix cornercases

This commit is contained in:
daboe01
2015-02-21 20:01:53 +01:00
parent a7c234b272
commit e9efe5bbb7
+2 -2
View File
@@ -1658,7 +1658,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
return _MakeRangeFromAbs(wordRange.location, MIN(MAX(0, numberOfCharacters - 1), searchIndex));
}
// -> extend to the left
for (var searchIndex = index - 1; searchIndex > 0 && regex.exec(_characterTripletFromStringAtIndex(string, searchIndex)) === null; searchIndex--)
for (var searchIndex = index - 1; searchIndex >= 0 && regex.exec(_characterTripletFromStringAtIndex(string, searchIndex)) === null; searchIndex--)
{
wordRange.location = searchIndex;
}
@@ -1668,7 +1668,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
{
index++;
}
return _MakeRangeFromAbs(wordRange.location, MIN(MAX(0, numberOfCharacters - 1), index));
return _MakeRangeFromAbs(wordRange.location, MIN(MAX(0, numberOfCharacters), index));
}
- (CPRange)selectionRangeForProposedRange:(CPRange)proposedRange granularity:(CPSelectionGranularity)granularity