You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/06/07 08:08:14 UTC

[15/50] 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/7274bdd7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7274bdd7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7274bdd7

Branch: refs/heads/0.14-dev
Commit: 7274bdd726451deb8257c96d646ce02259e89419
Parents: 9778415
Author: acton393 <zh...@gmail.com>
Authored: Thu Jun 1 15:37:04 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Fri Jun 2 10:27:00 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/7274bdd7/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 90ab4ce..deeddd6 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m
@@ -748,9 +748,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) {