Wrapping that preserves indentation

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
carymilsap
Posts: 3
Joined: Sun Apr 23, 2017 8:49 am

Wrapping that preserves indentation

Post by carymilsap » Thu Jan 09, 2020 2:01 am

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?

adrian
Posts: 2666
Joined: Tue May 17, 2005 4:01 pm

Re: Wrapping that preserves indentation

Post by adrian » Thu Jan 09, 2020 10:56 am

Hello,
carymilsap wrote:
Thu Jan 09, 2020 2:01 am
Is 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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

carymilsap
Posts: 3
Joined: Sun Apr 23, 2017 8:49 am

Re: Wrapping that preserves indentation

Post by carymilsap » Thu Jan 09, 2020 6:29 pm

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.

adrian
Posts: 2666
Joined: Tue May 17, 2005 4:01 pm

Re: Wrapping that preserves indentation

Post by adrian » Fri Jan 24, 2020 3:09 pm

carymilsap wrote:
Thu Jan 09, 2020 6:29 pm
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:
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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Post Reply