CRLF in the code of a single object in sequence diagrams

0 votes
asked Dec 5, 2022 in Question / help by scotofil (120 points)
retagged Dec 5, 2022 by scotofil

Hi, probably a n00b question, with a hopefully easy answer: using 1.2022.4, can I add CRLFs in the source (i.e. not in the depicted object) for the sake of editing clarity? If so what is the correct way?

I was looking for some escape character (like when using CRLFs within a command in shell scripts), but could not really get it to work.

A frequent example where I would love to use CRLFs within the source code is a note object with a rather long comment and several \ns in it (or simply a list in the comment):

Instead of 

note left #yellow: Lorem ipsum dolor sit amet, consectetur adipiscing elit,\nsed do eiusmod tempor incididunt ut labore et dolore magna\naliqua. Ut enim ad minim veniam, quis nostrud exercitation\nullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit\nesse cillum dolore eu fugiat nulla pariatur. Excepteur sint\noccaecat cupidatat non proident, sunt in culpa qui officia\ndeserunt mollit anim id est laborum.

It would be nice to have something like

note left #yellow: Lorem ipsum dolor sit amet, consectetur adipiscing elit,\n
~ sed do eiusmod tempor incididunt ut labore et dolore magna\n
~ aliqua. Ut enim ad minim veniam, quis nostrud exercitation\n
~ ullamco laboris nisi ut aliquip ex ea commodo consequat.\n
~ Duis aute irure dolor in reprehenderit in voluptate velit\n
~ esse cillum dolore eu fugiat nulla pariatur. Excepteur sint\n
~ occaecat cupidatat non proident, sunt in culpa qui officia\n
~ deserunt mollit anim id est laborum.

Thanks in advance!

1 Answer

+1 vote
answered Dec 5, 2022 by The-Lu (65,440 points)
selected Dec 5, 2022 by scotofil
 
Best answer

Hello S., and all,

You can use `\`, to mention continuation line, as:

note left #yellow: Lorem ipsum dolor sit amet, consectetur adipiscing elit,\n\
sed do eiusmod tempor incididunt ut labore et dolore magna\n\
aliqua. Ut enim ad minim veniam, quis nostrud exercitation\n\
ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\
Duis aute irure dolor in reprehenderit in voluptate velit\n\
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint\n\
occaecat cupidatat non proident, sunt in culpa qui officia\n\
deserunt mollit anim id est laborum.

Enjoy,
Regards. 

commented Dec 5, 2022 by scotofil (120 points)
Indeed; works like a charm!

Thanks for the prompt answer!
...