Newline in state diagrams is inconsistent

0 votes
asked Feb 8, 2021 in Bug by sashee (200 points)

I'm having trouble figuring out how to use newlines in state diagram bodies (not in the name of the states). It used to work using \n\, but it seems to be changed now.

Also, I'm experiencing inconsistent behavior.

This shows several lines:

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuG8oIb8LYWqLghcuWAILGavcNgfXJ9u2c644Oa2Onb2boLorN0wfUIb0pG00

But when I remove the inner state, the newlines are broken:

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuG8oIb8LYWqLghcuWAILGavcNgfXJ9u2c644Oa2OnbnS3gbvAK0z0000

What is the proper way to add multiple lines? If I use s1: multiple times it outputs multiple lines, but then I can't use leading whitespace. Example: http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuG8oIb8LYWqLghcuWAILGavcNgeXXAa0vXX1EL2kCPT3QbuAK2i0

commented Feb 9, 2021 by Martin (8,360 points)
edited Feb 9, 2021 by Martin

How strange [that removing the inner state changes the parsing such].

Here's an ugly workaround by coding the character code for a space in the first position.

@startuml
state s1
s1 : line1
s1 : <U+0020> line2
s1 : <U+0020>   line3
@enduml

Oddly \t works(!) and you could set tabsize to 2:

@startuml
skinparam tabSize 2
state s1
s1 : line1
s1 : \tline2
s1 : \t\tline3
@enduml

1 Answer

0 votes
answered Feb 10, 2021 by plantuml (294,960 points)

Many thanks for the report, and sorry about the regression.

This is fixed in last beta http://beta.plantuml.net/plantuml.jar and on the online server.

(Caution, there might be some cache issues with the online server)

Tell us if you find other issues!

...