Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Conversation

yury
Copy link
Contributor

@yury yury commented Jan 25, 2016

Actually it is possible that truncated string is longer then original
string.

For example, original string:

hello
this is
very long
message here
and there

with maximumNumberOfLines=4, truncationAttributedString = ' ...' and
additionalTruncationMessage = 'read more'

will give

hello
this is
very long
message here ... read more

So [attributedString attribute:attributeName atIndex:characterIndex longestEffectiveRange:&range inRange:visibleRange] will crash.

Actually it is possible that truncated string is longer then original
string.

For example, original string:

```
hello
this is
very long
message here
and there
```

with maximumNumberOfLines=4, truncationAttributedString = ' ...' and
additionalTruncationMessage = 'read more'

will give

```
hello
this is
very long
message here ... read more
```

So `[attributedString attribute:attributeName atIndex:characterIndex
longestEffectiveRange:&range inRange:visibleRange]` will crash.
@yury
Copy link
Contributor Author

yury commented Jan 25, 2016

Also related to #1110

@yury
Copy link
Contributor Author

yury commented Jan 25, 2016

Also, there are two unported commits from ComponentKit 1 and 2. I can port them with new PR

@appleguy
Copy link
Contributor

@yury thanks a lot for porting the other CK commits!! @ocrickard anything else we should be aware of? I wonder if there's a way to set up something similar to a Herald rule to notify me when text components change :)

@appleguy appleguy changed the title Fix Out of bounds error [ASTextNode] Fix out-of-bounds error when truncation string is longer than the original string. Jan 25, 2016
@appleguy appleguy added this to the 1.9.7 milestone Jan 25, 2016
appleguy added a commit that referenced this pull request Jan 26, 2016
[ASTextNode] Fix out-of-bounds error when truncation string is longer than the original string.
@appleguy appleguy merged commit d70a955 into facebookarchive:master Jan 26, 2016
@appleguy
Copy link
Contributor

@yury could you send me an example test case for this so I can integrate it into the unit tests? If you're able to add a snapshot / unit test for this directly, that would be phenomenal too :). asyncdisplaykit@gmail.com

@yury
Copy link
Contributor Author

yury commented Jan 26, 2016

@appleguy ported to commits from component kit #1119.

yxztj pushed a commit to iftechio/AsyncDisplayKit that referenced this pull request Sep 29, 2018
…chive#1111)

* fix SIMULATE_WEB_RESPONSE not imported facebookarchive#449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.

* Fix interface state not update correctly during layer thrash

* add change log
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants