This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 216986 - Bizarre indenting when inserting line breaks in mixed content
Summary: Bizarre indenting when inserting line breaks in mixed content
Status: RESOLVED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Text-Edit (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-16 19:40 UTC by Jesse Glick
Modified: 2012-10-19 18:17 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-08-16 19:40:34 UTC
7.3 dev. Given, say, DocBook text:

<para>
    This is one sentence. This is another.
</para>

I can place caret between the sentences and hit Enter to break the lines more naturally:

<para>
    This is one sentence.
    This is another.
</para>


But if there are inline tags, all this becomes unwieldy. Say there is a tag before the break point:

<para>
    This is <emphasis>one</emphasis> sentence. This is another.
</para>

Hitting ENTER indents oddly:

<para>
    This is <emphasis>one</emphasis> sentence.
            This is another.
</para>


Worse, if there is tag after the break point, it all gets mangled:

<para>
    This is <emphasis>one</emphasis> sentence. This is <emphasis>another</emphasis> sentence.
</para>

becomes

<para>
    This is <emphasis>one</emphasis> sentence.
This is
            <emphasis>another</emphasis> sentence.
</para>

presumably though some misguided attempt to align tags (?). Even though you only attempted to insert one line break, every inline tag in the rest of the line is now placed on its own line, and heavily indented.


The upshot is that the NB XML editor is unusable for markup (i.e. documents with a mixed content model).
Comment 1 Svata Dedic 2012-09-03 14:18:06 UTC
Fixed in http://hg.netbeans.org/jet-main/rev/a7fb6ba6d8d6
Comment 2 Quality Engineering 2012-09-04 01:12:50 UTC
Integrated into 'main-golden', will be available in build *201209040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a7fb6ba6d8d6
User: Svata Dedic <sdedic@netbeans.org>
Log: #217342, #216986: Formatter refactored, testcases added. Now does not copy from document, works with charsequences.
Comment 3 Jesse Glick 2012-09-04 17:58:42 UTC
Still some lesser bugs here:


1. If there are any tags after the newline insertion point, the new line is not indented at all. Tags prior to the insertion point are fine.


2. The reindent action does nothing on a line containing inline tags.


3. The originally reported bug still exists in some cases, e.g.

<para>
    One sentence. Also <ulink url="..."><classname>Stuff</classname></ulink> here.
</para>

=>

<para>
    One sentence.
Also <ulink url="...">
        <classname>Stuff</classname>
    </ulink> here.
</para>
Comment 4 Svata Dedic 2012-09-07 13:25:07 UTC
Changeset: 5f6f2f70baeb
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-09-07 15:25
Message:   Issue #216986 - Bizarre indenting when inserting line breaks in mixed content: fixed
Text content is indented iff at least partially in the formatted area.
Comment 5 Svata Dedic 2012-09-07 13:32:43 UTC
The mixed content is still formatted into several separate lines after newline; the formatter lacks information that only 1 line should be indented - it is called to indent a range of characters.
Comment 6 Quality Engineering 2012-09-08 02:08:27 UTC
Integrated into 'main-golden', will be available in build *201209080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/5f6f2f70baeb
User: Svata Dedic <sdedic@netbeans.org>
Log: Issue #216986 - Bizarre indenting when inserting line breaks in mixed content: fixed
Text content is indented iff at least partially in the formatted area.
Comment 7 Svata Dedic 2012-10-10 08:58:01 UTC
Sorry, forgot to mark this one as fixed.
Comment 8 Jesse Glick 2012-10-19 18:17:39 UTC
Thanks, have not noticed any serious issues with mixed content in 20121011-25754d256dcf.