You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/06/02 03:58:44 UTC

[3/6] incubator-weex git commit: * [ios] use intersectionRange compare

* [ios] use intersectionRange compare


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/8d7058a0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/8d7058a0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/8d7058a0

Branch: refs/heads/0.14-dev
Commit: 8d7058a0355283cf38f7c6d1a3243c479d4763c5
Parents: 7eeed01
Author: acton393 <zh...@gmail.com>
Authored: Thu Jun 1 15:37:04 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Thu Jun 1 15:37:04 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/8d7058a0/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
index d52be6a..ce38baf 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -746,9 +746,10 @@ do {\
         NSAttributedString * lastLineText = nil;
         NSRange lastLineTextRange = WXNSRangeFromCFRange(CTLineGetStringRange(lastLine));
         NSRange attributeStringRange = NSRangeFromString(attributedString.string);
-        if (!NSEqualRanges(NSUnionRange(lastLineTextRange, attributeStringRange), attributeStringRange)) {
+        NSRange interSectionRange = NSIntersectionRange(lastLineTextRange, attributeStringRange);
+        if (!NSEqualRanges(interSectionRange, lastLineTextRange)) {
             // out of bounds
-            lastLineTextRange = NSMakeRange(attributeStringRange.location, attributeStringRange.length);
+            lastLineTextRange = interSectionRange;
         }
         lastLineText = [attributedString attributedSubstringFromRange: lastLineTextRange];
         if (!lastLineText) {