additional line breaks with Ctrl+Shift+P

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Oleksii
Posts: 84
Joined: Wed Jul 19, 2017 6:04 pm
Location: Austria
Contact:

additional line breaks with Ctrl+Shift+P

Post by Oleksii »

Which option could lead to the behaviour that more spaces were automatically added?

Code: Select all

<!--
Do not edit this file directly!
This file is generated automatically by processing
styleguide.ditamap







If you want to change the rules, edit the corresponding sections
marked with audience="rules" in the corresponding topic files.
-->
Last edited by Oleksii on Fri Feb 01, 2019 12:01 pm, edited 1 time in total.
Kind regards,
Oleksii Sapov-Erlinger
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: unexpected formattin behaviour

Post by Radu »

Hi,

Do you mean that at some point consecutive new lines were added in this specific XML comment?
From what I know Oxygen would sometimes add line breaks and indenting between XML tags and we have the behavior explained here:

https://www.oxygenxml.com/doc/versions/ ... odes2.html

but Oxygen should never insert such consecutive white spaces inside XML comments when editing the document. Can you reproduce the problem consistently on your side using Oxygen? If you are using a remote storage system (like a CMS) it may be possible that the storage system may have added those extra spaces in the XML comment.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Oleksii
Posts: 84
Joined: Wed Jul 19, 2017 6:04 pm
Location: Austria
Contact:

Re: unexpected formattin behaviour

Post by Oleksii »

Hi Radu,

as you see I changed the post topic. The problem occurs under the following conditions:
- add the line break (with Enter)
- then every time after Ctrl+Shift+P, an additional line break is being added

The following setting has obviously an effect on this:
Options > Preferences > Editor > XML > Line Break Tab

I set it to:
Element name/XPath: '//*' with both Before/After checked options.

The reason for this was that for some elements no indentation worked. e.g. for

Code: Select all

<supplied xml:id="supplied_3735" ><dynam xml:id="dynam_3735" staff="4" startid="#note_3630" doxml.id="d28e257">f</dynam>
</supplied>
I wanted the

Code: Select all

<dynam/>
to be on a new line. So probably the solution was not the best. Can you recommend something better?
NB: "Indent inline elements" option is checked.

Best Oleksii
Radu wrote:Hi,

Do you mean that at some point consecutive new lines were added in this specific XML comment?
From what I know Oxygen would sometimes add line breaks and indenting between XML tags and we have the behavior explained here:

https://www.oxygenxml.com/doc/versions/ ... odes2.html

but Oxygen should never insert such consecutive white spaces inside XML comments when editing the document. Can you reproduce the problem consistently on your side using Oxygen? If you are using a remote storage system (like a CMS) it may be possible that the storage system may have added those extra spaces in the XML comment.

Regards,
Radu
Kind regards,
Oleksii Sapov-Erlinger
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: additional line breaks with Ctrl+Shift+P

Post by Radu »

Hi Oleksii,

I understand, this looks like a small bug in Oxygen as it should never add consecutive lines if the lines are already there. We'll look into it.
Coming back to your original problem, indeed Oxygen avoids adding spaces or new lines in elements (like in your case <supplied>) which also have text content because it considers that adding spaces there would change the semantic of the element. I'm afraid I do not have a good workaround for you right now.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Oleksii
Posts: 84
Joined: Wed Jul 19, 2017 6:04 pm
Location: Austria
Contact:

Re: additional line breaks with Ctrl+Shift+P

Post by Oleksii »

Hi Radu,

my intermediate workaround was to define '//*' for line breaks and uncheck 'Preserve empty lines" bcs. in our .xml we don't need emtpy lines at all. The n added two entries in 'Preserve space' for 'xsl:stylesheet' and 'schematron'. So I could work in those.

But, I found out that the problem is obviously in our schema which does not makes indent after/before <supplied/> (which can have also descendants with no text() ). In the meanwhile before checking the Relax NG XML syntax (do you know maybe what is there responsible for indent) I tried the workaround to pass the XPath

Code: Select all

//supplied/descendant::node()
into 'Line break'. But it doesn't work. Only, if just makes the entries for every single element, e.g. ' slur', 'dynam', etc.

Best Oleksii
Kind regards,
Oleksii Sapov-Erlinger
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: additional line breaks with Ctrl+Shift+P

Post by Radu »

Hi Oleksii,

The XPath-like expressions which you can set up in the configuration lists should be very simple, for example you should try something like this:

Code: Select all

supplied/*
We do not support full XPath 2.0 expressions because evaluating them would take a long time as each node in the XML document would need to be matched against the expression.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Oleksii
Posts: 84
Joined: Wed Jul 19, 2017 6:04 pm
Location: Austria
Contact:

Re: additional line breaks with Ctrl+Shift+P

Post by Oleksii »

Thank you, it works.
What a kind of XPath syntax is it and where is it defined?
Kind regards,
Oleksii Sapov-Erlinger
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: additional line breaks with Ctrl+Shift+P

Post by Radu »

Hi Oleksii,

This topic in our user's guide discusses about what the XPath-like expressions should look like:

https://www.oxygenxml.com/doc/versions/ ... t-xml.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Oleksii
Posts: 84
Joined: Wed Jul 19, 2017 6:04 pm
Location: Austria
Contact:

Re: additional line breaks with Ctrl+Shift+P

Post by Oleksii »

If I check the box Schema-aware format and indent and delete the schema association, the problem occurs anyway. Strangely, that it occurs only on supplied/descendants::*

Code: Select all

<supplied  xml:id="supplied_d1e1575">
<accid xml:id="accid_d1e1575_01" accid="n"/>
</supplied>
Another question: is there any option to declare elements where the indentation is not allowed?
Kind regards,
Oleksii Sapov-Erlinger
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: additional line breaks with Ctrl+Shift+P

Post by Radu »

Hi Oleksii,

In the same Oxygen Preferences->"Editor / Format / XML" page there is a "Preserve Space" tab containing a list of space-preserve elements. Is this what you need?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: additional line breaks with Ctrl+Shift+P

Post by Radu »

Hi,

In the recently released Oxygen 22.1 we fixed the bug which added new lines when format and indent was performed.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply