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

Is SpanRange end really exclusive? #593

Open
knopp opened this issue May 27, 2022 · 2 comments
Open

Is SpanRange end really exclusive? #593

knopp opened this issue May 27, 2022 · 2 comments

Comments

@knopp
Copy link
Contributor

knopp commented May 27, 2022

The documentation claims that the character at end is not included. However the code

    final t = AttributedText(text: 'Some text here');
    t.addAttribution(boldAttribution, const SpanRange(start: 2, end: 3));
    print('1> $t');
    print('2> ${t.spans.collapseSpans(contentLength: 6)}');

Prints

1> [AttributedText] - "Some text here"
[AttributedSpans] (1 spans):
 - [SpanMarker] - attribution: [NamedAttribution]: bold, offset: 2, type: SpanMarkerType.start
 - [SpanMarker] - attribution: [NamedAttribution]: bold, offset: 3, type: SpanMarkerType.end
2> [[MultiAttributionSpan] - attributions: {}, start: 0, end: 1, [MultiAttributionSpan] - attributions: {[NamedAttribution]: bold}, start: 2, end: 3, [MultiAttributionSpan] - attributions: {}, start: 4, end: 5]

Would suggest that the end in SpanRange is actually inclusive.

@domesticmouse
Copy link
Contributor

This may be related to #632

@jmatth
Copy link
Contributor

jmatth commented Jun 23, 2022

Edit: posted on the wrong issue. Here's a link to my comment in the correct issue: #632 (comment)

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

No branches or pull requests

3 participants