Skip to content

CodeArea.getStyleSpans(from, to).append(...) does not append #191

@jmak35

Description

@jmak35

Hi Tomas,

I'm getting an issue with using the above method like so:

StyleSpans<Collection<String>> styleSpans = codeArea.getStyleSpans(startIndex, startIndex + text.length());

StyleSpansBuilder<Collection<String>> spansBuilder = new StyleSpansBuilder<>();
spansBuilder.add(Collections.singleton("class1"), text.length());
spansBuilder.add(Collections.singleton("class2"), text.length());

spansBuilder.create().forEach(styleSpans::append);

After this code executes, styleSpans still has a length of 0. If it was unmodifiable I'd assume it would've thrown an exception, but I believe that is not the case.

Is there anything I'm doing wrong?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions