Skip to content

[0.7-M5] Calling setParagraphStyle on an empty Paragraph [p.length() == 0] throws Exception #481

@neilccbrown

Description

@neilccbrown

With version 0.7M5, if I call setParagraphStyle, I get an exception saying that it's invalid to have a (rich text) change which doesn't add or remove text. This seems like a bug given that setParagraphStyle does exactly that, and in general it should be valid to have a rich text change which only changes styles. Stack trace:

java.lang.IllegalStateException: Cannot get the type of a change that neither inserts nor deletes anything.
	at org.fxmisc.richtext.model.TextChange.<init>(TextChange.java:31)
	at org.fxmisc.richtext.model.RichTextChange.<init>(RichTextChange.java:6)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$null$7(ReadOnlyStyledDocument.java:274)
	at org.reactfx.util.Tuple2.map(Tuple2.java:31)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$replace$8(ReadOnlyStyledDocument.java:271)
	at org.reactfx.util.Tuple2.map(Tuple2.java:31)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:270)
	at org.fxmisc.richtext.model.ReadOnlyStyledDocument.replaceParagraph(ReadOnlyStyledDocument.java:285)
	at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.setParagraphStyle(GenericEditableStyledDocumentBase.java:179)
	at org.fxmisc.richtext.model.SimpleEditableStyledDocument.setParagraphStyle(SimpleEditableStyledDocument.java:7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions