pytiled_parser icon indicating copy to clipboard operation
pytiled_parser copied to clipboard

Fix multiline string properties

Open KockaAdmiralac opened this issue 1 year ago • 0 comments

On Tiled version 1.11.0 (and earlier), string properties spanning multiple lines are supported. Next to the property's value, a "..." button appears which opens a multiline textbox where these strings can be written. Here is a map I created with a multiline string property.

Regular string properties look like this:

    <property name="description" value="&quot;10 steps to the East - 2nd Sign&quot;"/>

Multiline string properties look like this:

    <property name="description">&quot;10 steps to the East - 3rd Sign
10 steps to the West - 1st Sign&quot;</property>

Their contents are stored in the node text, instead of an attribute.

The documentation also states (since 2017):

When a string property contains newlines, the current version of Tiled will write out the value as characters contained inside the property element rather than as the value attribute. It is possible that a future version of the TMX format will switch to always saving property values inside the element rather than as an attribute.

This pull request fixes this issue, and adds a test for it.

KockaAdmiralac avatar Aug 23 '24 23:08 KockaAdmiralac