Page 1 of 1

Wrapping that preserves indentation

Posted: Thu Jan 09, 2020 2:01 am
by carymilsap
I'd like to be able to have XML that looks like this, without having to manually break lines:

Code: Select all

<xsl:choose>
    <xsl:when test="$whatever">
        <p>
            Pretend that this is a long paragraph (there's no newline here)
            that has to wrap.
        </p>
    </xsl:when>
</xsl:choose>
But what I get with everything I've tried with <oXygen/>'s preferences displays like this when it wraps:

Code: Select all

<xsl:choose>
    <xsl:when test="$whatever">
        <p>
            Pretend that this is a long paragraph (there's no newline here)
that has to wrap.
        </p>
    </xsl:when>
</xsl:choose>
Is there any way to make automatic wrapping indent to the same level as the first line?

Re: Wrapping that preserves indentation

Posted: Thu Jan 09, 2020 10:56 am
by adrian
Hello,
carymilsap wrote: Thu Jan 09, 2020 2:01 amIs there any way to make automatic wrapping indent to the same level as the first line?
The Line wrap option from Options > Preferences, Editor / Edit Modes / Text is a "soft" line wrap, which means it wraps the text on multiple lines only visually. It does not touch the content and it does not indent the wrapped text. It's not possible to obtain indented soft line wrapped text in Oxygen.

As for hard line wrapping, it is possible to configure Oxygen to format the document that way (Format and Indent), but note that it implies modifying the content (inserting the line break and indent in the XML content).

Regards,
Adrian

Re: Wrapping that preserves indentation

Posted: Thu Jan 09, 2020 6:29 pm
by carymilsap
I was afraid of that. Soft line wrapping that honors the indent level when displayed by Oxygen is exactly what I'm looking for.

I don't mind changing the content by inserting line breaks. That's what I'm doing now. But unfortunately, Oxygen's Format and Indent feature doesn't help me because even when I don't select the surrounding element tokens, the formatter includes them in the formatted result, which messes up the way my XSLT code looks:

Code: Select all

<xsl:choose>
    <xsl:when test="$whatever">
        <p> Pretend that this is a long paragraph (there's no newline here)
        that has to wrap. </p>
    </xsl:when>
</xsl:choose>
It's not so bad in this example, when the element is a simple <p>, but it's unacceptable when the element that's integrated into the text is something more complicated like <xsl:when ...>.

So I have to insert line breaks by hand, which is intensely tedious. It diminishes the experience of using Oxygen, for sure.

Re: Wrapping that preserves indentation

Posted: Fri Jan 24, 2020 3:09 pm
by adrian
carymilsap wrote: Thu Jan 09, 2020 6:29 pmBut unfortunately, Oxygen's Format and Indent feature doesn't help me because even when I don't select the surrounding element tokens, the formatter includes them in the formatted result, which messes up the way my XSLT code looks:
The formatter works at element level, you can't format just the text from within the p element, you can only format the p element itself.
If you want to format only the current element or selection, use contextual menu > Source > Format and Indent Element / Ctrl+Shift+I/Cmd+Shift+I.

Regards,
Adrian