Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[attributed_text] Fix invalid end index with an marker that exceeds text length (Resolves #632) #1765

Merged
merged 2 commits into from
Jan 9, 2024

Conversation

angelosilvestre
Copy link
Collaborator

[attributed_text] Fix invalid end index with an marker that exceeds text length. Resolves #632

When an AttributedText has a SpanMarker with an end index equals to the text length (which is an invalid index, because the spans are inclusive), collapseSpans returns a span with an end index equal to the text length, instead of the text length -1, which is the expected index that would point to the last character.

This PR fixes the comparison that causes this behavior.

Copy link
Contributor

@matthew-carroll matthew-carroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matthew-carroll matthew-carroll merged commit 06b89b4 into main Jan 9, 2024
11 checks passed
@matthew-carroll matthew-carroll deleted the 632_collapsed_spans branch January 9, 2024 19:35
github-actions bot pushed a commit that referenced this pull request Jan 9, 2024
matthew-carroll pushed a commit that referenced this pull request Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributedText: collapsedSpans returns overly large MultiAttributionSpan for unattributed string
2 participants